-
Notifications
You must be signed in to change notification settings - Fork 524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix column indices for embedded spreadsheets #664
Fix column indices for embedded spreadsheets #664
Conversation
@michael-roth Great fix. Could you rebase your PR to the I really need to add more unit tests for testing this. Could you fix you can add it ? |
f2c05bf
to
104216a
Compare
@Progi1984 Thanks. I rebased, fixed the remaining lines and added tests to check the series values. What do you think? Let me know if you need more. |
@michael-roth Yeap, I have a last thing to test and it's ok. I add comment in code. 😍 on your bugfix. |
tests/PhpPresentation/Tests/_includes/PhpPresentationTestCase.php
Outdated
Show resolved
Hide resolved
tests/PhpPresentation/Tests/_includes/PhpPresentationTestCase.php
Outdated
Show resolved
Hide resolved
@@ -107,20 +107,26 @@ public function testChartIncludeSpreadsheet(): void | |||
$this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); | |||
$element = '/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser'; | |||
$this->assertZipXmlElementExists('ppt/charts/' . $oShape->getIndexedFilename(), $element); | |||
$this->assertZipXmlElementCount('ppt/charts/' . $oShape->getIndexedFilename(), $element, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you for testChartIncludeSpreadsheet
a dataProvider
which pass in parameter
- each chartType (Line/Radar....) where you have made a change in
PptCharts
- a string for element xml
c:lineChart
relative to each chartType
?
That allows me to check that each change in PptCharts
is ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A last feedback
@Progi1984 I worked on your feedback and changed a few things:
|
- Move xml elements in chart writer to fix schema - Change xml path for Scatter chart test
d47e21c
to
c3e6ad9
Compare
Hi @Progi1984, I am waiting for this PR to be merged, as I use the embedded spreadsheets a lot. |
Superseeded by #773 |
This fixes a bug with embedded spreadsheet data.
Reproduction
Expected result
Chart data is editable, chart won't break
Actual result
Chart data is not editable or chart labels break
Cause
The bug is caused by wrong column indices in the chart writer. PhpSpreadsheet uses one-based indices for columns while zero-based indices are used in the writer.