EPPlusSoftware / EPPlus

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

Throws KeyNotFoundException when getting the count of drawings. #1673

Open robincodex opened 6 days ago

robincodex commented 6 days ago

EPPlus usage

Personal use

Environment

Windows

Epplus version

7.4.0

Spreadsheet application

Microsoft365 Excel

Description

This error appears after version 7.4.0, version 4.3.2 doesn't have this problem.

test.xlsx

This error occurs when sheet.Drawings.Count

System.Collections.Generic.KeyNotFoundException: The given key '' was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at OfficeOpenXml.Packaging.ZipPackageRelationshipCollection.get_Item(String id)
   at OfficeOpenXml.Packaging.ZipPackagePartBase.GetRelationship(String id)
   at OfficeOpenXml.Drawing.ExcelPicture..ctor(ExcelDrawings drawings, XmlNode node, ExcelGroupShape shape)
   at OfficeOpenXml.Drawing.ExcelDrawing.GetDrawingFromNode(ExcelDrawings drawings, XmlNode node, XmlElement drawNode, ExcelGroupShape parent)
   at OfficeOpenXml.Drawing.ExcelDrawing.GetDrawing(ExcelDrawings drawings, XmlNode node)
   at OfficeOpenXml.Drawing.ExcelDrawings.AddDrawings()
   at OfficeOpenXml.Drawing.ExcelDrawings..ctor(ExcelPackage xlPackage, ExcelWorksheet sheet)
   at OfficeOpenXml.ExcelWorksheet.LoadDrawings()
   at OfficeOpenXml.ExcelWorksheet.get_Drawings()
swmal commented 6 days ago

Thanks for reporting, we will have a look at this.