EPPlus.Core icon indicating copy to clipboard operation
EPPlus.Core copied to clipboard

Error When Opening Sample2 Created on Ubuntu in Windows Excel

Open mogulman52 opened this issue 7 years ago • 2 comments

I installed EPPlus.Core on Windows and Ubuntu. Made a few changes for compatibility so Windows and Linux source is identical.

Main string working = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); DirectoryInfo outputDir = new DirectoryInfo(working); Sample1&2 Used Path.Combine string outPath = Path.Combine(outputDir.FullName, "Sample1.xlsx");
FileInfo templateFile = new FileInfo(outPath);

Works perfectly on Windows and am able to open in Excel 2010. Runs perfectly on Ubuntu. Move Ubuntu output to Windows. Sample1 opens up perfectly. Sample2 gives an error and prompts me to repair it. It opens perfectly after being repaired and I don't see any issue.

The error log is:
   xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error343960_01.xml</logFileName><summary>Errors were detected in file 'C:\temp\Sample2.xlsx'</summary><removedRecords summary="Following is a list of removed records:"><removedRecord>Removed Records: Named range from /xl/workbook.xml part (Workbook)</removedRecord></removedRecords></recoveryLog>

The named range "SubTotalName" is there and correct.

mogulman52 avatar Sep 03 '17 17:09 mogulman52

  • Sample1 and 2? Sample 2 doesn't produce any files.
  • Usually Removed Records: Named range from /xl/workbook.xml part (Workbook) means you have badly named worksheets. more info

VahidN avatar Sep 04 '17 04:09 VahidN

Sorry about not being more specific. I'm referring to this demo. I did a little more work on it. I unzipped the xlsx Sample2 file (added .zip extension and unzipped it). I compared it to the repaired file and found EPPlus did remove some tick marks in workbook.xml and chart1.xml. Example:

<definedName name="_xlnm._FilterDatabase" localSheetId="0" hidden="1">'Inventry'!$A$1:$E$4</definedName> <definedName name="_xlnm.Print_Titles" localSheetId="0">'Inventry'!$A$1:$E$1048578</definedName> <definedName name="SubTotalName" localSheetId="0">'Inventry'!$C$7:$E$7</definedName>

I compared the original and repaired files using WinMerge and found the repair process changed 100's of things. I tried manually fixing the tick problem and rezipping it to create the .xlsx file but it still gave the same error. Still not clear why EPPlus is adding tick marks. I'm thinking in Sample2 it is using Sample1 as a template file.

ExcelPackage package = new ExcelPackage(newFile, templateFile)

When I get time I'll research this some more.

mogulman52 avatar Sep 05 '17 14:09 mogulman52