0
votes

I created excel file by EPPlus with 2 sheets: data and chart on the data. Excel can open the file without any errors.

Now, I read (by EPPlus) and save the file again without any changes and Excel opens the file with error message and doesn't show chart.

enter image description here enter image description here xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error118920_01.xml</logFileName><summary>Errors were detected in file 'file.xlsx'</summary><removedParts summary="Following is a list of removed parts:"><removedPart>Removed Part: /xl/drawings/drawing1.xml part. (Drawing shape)</removedPart></removedParts></recoveryLog>

1
Those errors are very generic so will not tell us much unfortunately. Best thing to do would be to paste your code that created it and then reopened/saved it.Ernie S
Create sample github.com/constructor-igor/TechSugar/tree/master/EPPlusSamples but I cannot reproduce the issue with help of the sample. Right now, I cannot publish production code,constructor
Tough to diagnose if it is not reproducible. Maybe post the problem file?Ernie S
added test (including source and problematic target excel files) ProductionFile_OpenSave_CannotBeOpened in github.com/constructor-igor/TechSugar/tree/master/EPPlusSamples/…constructor

1 Answers

0
votes

Sorry for such a late answer. Seems like that Excel file has a bad reference in the chart x-axis. If you go to Select Data of the chart and hit Edit on the right for the Category axis labels you will see this:

enter image description here

But that ='Charts'! looks like a broken reference. Seems that Epplus cannot handle that very well - should probably log it as a bug. So, to fix it cancel out of that, click on the charts x-axis and hit delete. Should look like this after:

enter image description here

Save the file and run it though your unit test and it opens properly for me.

Ernie