Ask Your Question

Charts in XLSX documents generated with EPPLUS don't have colors in Calc

asked 2021-02-21 18:47:46 +0200

Asayhem gravatar image

I'm using the EPPLUS library to generate spreadsheets from C# applications and I'm trying to draw a simple pie chart on the worksheet. But when I open the file - all the colors/borders/any graphics is entirely missing from the chart, there are only numbers and labels floating over the empty area. example of the problem

If I open the same document in other programs - it works just fine. example of the same chart in goggle sheets

But if I save it from the Calc and then open in Excel - the graphics is missing there as well and the chart has no set style, the graphics returns if I select any style in Excel. I tried updating Calc from v6 to v7 to no avail. Tried completely uninstalling it and removing the residual files, then installing it back after the reboot. Nothing changed, Calc still doesn't want to draw those charts correctly. At this point I'm out of ideas, maybe you have any?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2021-02-22 17:24:18 +0200

Asayhem gravatar image

Further testing reveals that the problem lies within the EPPlus library of any versions. XLSX files created with that library are missing the necessary styles and make the charts look broken when open in LibreOffice. However if the file was is to be created in a different library, or just a regular XLSX file is to be used a template to be filled - everything works fine. Is there some kind of property in the document that LibreOffice depends on for drawing the charts? Maybe it can default to some style if the property is missing?

edit flag offensive delete link more


It doesn't matter if the document is generated using this library or that. What matters is if the document a valid OOXML. Please check if the files are valid XML (you may use Open XML SDK Productivity Tool for MS Office), and if the file is valid, file a bug report with attached sample and screenshots from Calc and Excel.

But if the file is not a valid OOXML, then it's a bug in the generator, and it just happens to work relying on specific treatment of invalid data by Excel, and that is something to inform the library developers.

Mike Kaganski gravatar imageMike Kaganski ( 2021-02-22 17:29:32 +0200 )edit

Thank you, I did just that, but unfortunately I'm not sure what to make of the results... I had one file generated and filled with EPPlus (tst.xlsx) and another generated with ZetExcel but filled identically with EPPlus (tstZE.xlsx) The tool marked both files as valid valid. However comparing both of them together clearly shows some difference difference in their internal relationships structure. The valid file also has a /docProps/core.xml component. But still they are both "valid"?

Here's both files opened side by side in LibreOffice Calc: LibreOffice Calc and Microsoft Excel: Microsoft Excel

You think that's a bug with Calc not interpreting some missing data or the library for not generating the necessary component? Does the validation account for that?

Asayhem gravatar imageAsayhem ( 2021-02-23 16:26:10 +0200 )edit

A good validator would catch some missing data required for some existing data. I can't know for sure how well the validator is made, but at the first approximation, we can assume it reports correct things. So just go ahead and file the bug report. Thank you!

Mike Kaganski gravatar imageMike Kaganski ( 2021-02-24 07:12:02 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2021-02-21 18:47:46 +0200

Seen: 28 times

Last updated: Feb 22