Created attachment 39069 [details] Generated XLS from POI Example Upon an (automatic) upgrade of Excel for Mac to v. 16.77 I have observed that all Charts created via POI / XSSF appear to be detected as corruption on-open. The repair result is this: Repair Result to ooxml-bar-chart2.xmlErrors were detected in file '/tmp/poi/ooxml-bar-chart.xlsx'Removed Part: /xl/drawings/drawing1.xml part. (Drawing shape) This was originally detected w/ some filed I made with POI, and to investigated I cloned src and ran a bunch of examples, with same result. Example: https://github.com/apache/poi/blob/trunk/poi-examples/src/main/java/org/apache/poi/examples/xssf/usermodel/BarChart.java
Can confirm issue appears for updated Excel on Mac. Encountering an error exclusively on Excel for Mac 16.77.1, while it works fine on version 16.66.1 Error reproduces using minimal setup from the official BarChart Example. Opening and resaving the file on a different Excel version is a temporary fix.
Can you attach the same file BEFORE and AFTER it was "fixed" by opening/saving in Excel?
Created attachment 39099 [details] original bar chart from documentation
Created attachment 39100 [details] Re-saved original bar chart from documentation
Added two files, the original generated from https://svn.apache.org/repos/asf/poi/trunk/poi-examples/src/main/java/org/apache/poi/examples/xssf/usermodel/BarChart.java and re-saved file which starts to be working.
thank you @ihor + @Dominik for taking a look! 👏 👏 😃
Hello, I can confirm that bug with the new Excel version 16.77 on MacOs and Windows, too. Even if this lib is fixed for new generated files, this bug is a real problem for retro-compatibility of old generated files. That's why I have contacted Microsoft support that has transferred my request to the tech team. Waiting now... Do you have any more information on your side ? Thank you, Olivier
My view is that this a Microsoft problem. They even get paid to fix problems. Apache POI is a free volunteer project. If your Excel install has a bug, then try loading the Excel files into something else - examples * hosted Excel support (eg on outlook.com) * load the xlsx with Google Spreadsheets * try it with LibreOffice or OpenOffice
A number of stackoverflow.com questions appear to have been created about this or similar issues recently and all of them appear to link to this answer. https://stackoverflow.com/questions/77131316/create-a-chart-in-a-powerpoint-using-apache-poi-and-java-from-scratch/77135432#77135432
This works well, thank you PJ Fanning! Fix is here: if (bottomAxis.hasNumberFormat()) bottomAxis.setNumberFormat("@"); if (rightAxis.hasNumberFormat()) rightAxis.setNumberFormat("#,##0.00");
Hello, Thank you very much, that fix the thing. More, the generated files could never been opened with Mac's Numbers and never found why, and it solved it, too ! Thanks !
Why would we resolve this ticket? Should be the fix applied for POI lib?
We can leave this open. We should make a POI change but I'm not sure when this will happen. If someone wants to try creating a patch with a test then we will certainly consider it.
I tried XDDFCategoryAxis private void initializeAxis(CTPlotArea plotArea, AxisPosition position) to do this: ctCatAx.addNewNumFmt().setSourceLinked(true); ctCatAx.getNumFmt().setFormatCode("@"); I don't have Microsoft products installed any more and my outlook.com Word online access just seems to hang if I load a POI generated docx file with or without this change. I don't have much time on this but I can review any submissions.
*** Bug 67726 has been marked as a duplicate of this bug. ***
*** Bug 67638 has been marked as a duplicate of this bug. ***
I added r1913672. I tested this using POI's BarChart example and it seems to fix that. Excel on outlook.com shows the chart after I apply this change locally and run the sample (and did not before I made this change).