Skip to content
This repository has been archived by the owner on Jan 25, 2019. It is now read-only.

Error When Opening Sample2 Created on Ubuntu in Windows Excel #23

Open
mogulman52 opened this issue Sep 3, 2017 · 2 comments
Open

Error When Opening Sample2 Created on Ubuntu in Windows Excel #23

mogulman52 opened this issue Sep 3, 2017 · 2 comments

Comments

@mogulman52
Copy link

mogulman52 commented Sep 3, 2017

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.

@VahidN
Copy link
Owner

VahidN commented Sep 4, 2017

  • 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

@mogulman52
Copy link
Author

mogulman52 commented Sep 5, 2017

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants