EPPlusSoftware / EPPlus

EPPlus-Excel spreadsheets for .NET
https://epplussoftware.com
Other
1.8k stars 274 forks source link

An error occurs when running package.Workbook On a particular workbook #1652

Open minren118 opened 4 days ago

minren118 commented 4 days ago

EPPlus usage

Noncommercial use

Environment

Windows

Epplus version

7.4.1.1067

Spreadsheet application

Excel365

Description

Another strange problem, running package.Workbook gives an error, but opening it on Excel shows no error at all

even use the newest develop version return error

System.ArgumentException HResult=0x80070057 Message=已添加了具有相同键的项。 Source=mscorlib StackTrace: at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at OfficeOpenXml.RichData.ExcelRichValueStructureCollection.ReadXml(Stream stream) at OfficeOpenXml.RichData.ExcelRichValueStructureCollection.LoadPart(ExcelWorkbook wb) at OfficeOpenXml.RichData.ExcelRichValueStructureCollection..ctor(ExcelWorkbook wb) at OfficeOpenXml.RichData.ExcelRichData..ctor(ExcelWorkbook wb) at OfficeOpenXml.ExcelWorksheet.GetErrorFromMetaData(MetaDataReference md, Object v) at OfficeOpenXml.ExcelWorksheet.SetValueFromXml(XmlReader xr, String type, Int32 styleID, Int32 row, Int32 col) at OfficeOpenXml.ExcelWorksheet.LoadCells(XmlReader xr) at OfficeOpenXml.ExcelWorksheet.CreateXml() at OfficeOpenXml.ExcelWorksheet..ctor(XmlNamespaceManager ns, ExcelPackage excelPackage, String relID, Uri uriWorksheet, String sheetName, Int32 sheetID, Int32 positionID, Nullable1 hide) at OfficeOpenXml.ExcelWorksheets..ctor(ExcelPackage pck, XmlNamespaceManager nsm, XmlNode topNode) at OfficeOpenXml.ExcelWorkbook.get_Worksheets() at OfficeOpenXml.ExcelWorkbook.GetDefinedNames() at OfficeOpenXml.ExcelPackage.get_Workbook() at ConsoleApp2.Program.Main(String[] args) in Program.cs:line 49

packageworkbookerror.xlsx

image

JanKallman commented 4 days ago

This file contains an undocumented error type, that causes this issue. :

<s t="_error">
<k n="errorType" t="i"/>
<k n="propagated" t="b"/>
<k n="ptg" t="i"/>
</s>

Was this file created using Excel?

minren118 commented 4 days ago

Yes, I just use EPPLUS to read and write data, most of the template content is processed by Excel.

JanKallman commented 4 days ago

Ok, I cant find any documentation of this error type...https://learn.microsoft.com/en-us/openspecs/office_standards/ms-xlsx/2c5dee00-eff2-4b22-92b6-0738acd4475e. We will rewrite the handling of rich data in EPPlus 8, so we will look at this as part of that.