Can not read excel with empty VmlDrawingPart

In CSharp program, we use OpenXml to export our data to excel file, 

Earlier, we used Syncfusion.XlsIO.Base.dll (version 11.104.0.52) to read this worksheet from xlsx file, we can read our excel file without any issue.

Then later we upgrade our Syncfusion to higher version, say Syncfusion.XlsIO.Portable.dll (20.1200.0.52 or later), and try to read the same excel file, there could be exception reported if the excel worksheet contains LegacyDrawing that is referenced to an empty VmlDrawingPart (Here I mean the VmlDrawingPart does not contain xml content).

The stack looks like the following:

System.Xml.XmlException

  HResult=0x80131940

  Message=Root element is missing.

  Source=System.Private.Xml

  StackTrace:

   at System.Xml.XmlTextReaderImpl.Throw(Exception e)

   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()

   at System.Xml.XmlTextReaderImpl.Read()

   at Syncfusion.XlsIO.Implementation.UtilityMethods.CreateReader(Stream data)

   at Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.CreateReaderAndFixBr(Relation relation, String parentItemPath, String& strItemPath)

   at Syncfusion.XlsIO.Implementation.XmlSerialization.WorksheetDataHolder.ParseVmlShapes(ShapeCollectionBase shapes, String relationId, RelationCollection relations)

   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseLegacyDrawing(XmlReader reader, WorksheetBaseImpl sheet)

   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseAfterSheetData(XmlReader reader, WorksheetImpl sheet, MemoryStream& streamCF, String strParentPath, Dictionary`2 dictItemsToRemove)

   at Syncfusion.XlsIO.Implementation.XmlSerialization.WorksheetDataHolder.ParseWorksheetData(WorksheetImpl sheet, Dictionary`2 dictUpdateSSTIndexes, Boolean parseOnDemand)

   at Syncfusion.XlsIO.Implementation.WorksheetImpl.ParseData(Dictionary`2 dictUpdatedSSTIndexes)

   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseWorksheets(Dictionary`2 dictUpdatedSSTIndexes, Boolean parseOnDemand)

   at Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.ParseWorkbook(List`1& themeColors, Boolean parseOnDemand)

   at Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.ParseDocument(List`1& themeColors, Boolean parseOnDemand)

   at Syncfusion.XlsIO.Implementation.WorkbookImpl.ParseExcel2007Stream(Stream stream, String password, Boolean parseOnDemand)

   at Syncfusion.XlsIO.Implementation.WorkbookImpl..ctor(IApplication application, Object parent, Stream stream, ExcelParseOptions options, ExcelVersion version)

   at Syncfusion.XlsIO.Implementation.ApplicationImpl.CreateWorkbook(Object parent, Stream stream, ExcelVersion version, ExcelParseOptions options)

   at Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(Stream stream, ExcelOpenType openType)


Any one has seen this before, and any idea on how to read legacy excel file from newer version of Syncfusion?


14 Replies

YV Yaavann Vignesh Sethuraman Syncfusion Team December 10, 2024 06:48 AM UTC

Hi Yang Eric Liu,

Since the reported issue occurs with a specific case, We kindly request you to share the input document for validation. This will help us to investigate the issue thoroughly and provide you a solution at the earliest.

Regards,
Yaavann.




EL Eric Liu December 12, 2024 01:58 AM UTC

Thanks very much for your quick reply, Yaavann


Please see the zip file attached


BR
Eric

Attachment: Sample_9ab86322.zip


EL Eric Liu December 12, 2024 02:04 AM UTC

Thanks very much for your quick reply, Yaavann


In last reply, I have attached zip file contains 3 files:


1. A sample Program.cs that we used to create the Excel file using OpenXml, here pay attention that we create an empty VmlDrawingPart and add to worksheetpart

2. Another sample Program.cs that we used to read the Excel using Syncfusion;

3. A "sample_export_data.xlsx" that we created using the first Program.cs, Please ignore the warning that we open it.


Earlier, we can read this kind of excel file with empty VmlDrawingPart using Syncfusion 11.104.0.52, but we cannot read this file with recent version of Syncfusion at least seen from 20.1200.0.52.


BR

Eric



YV Yaavann Vignesh Sethuraman Syncfusion Team December 12, 2024 07:11 AM UTC

Hi  Yang Eric Lu,

Thank you for sharing the input document with us. We are able to reproduce the reported issue at our end and currently validating it. We will share the validation details on December 14th, 2024.

Regards,
Yaavann.



AS Atchaya Sekar Syncfusion Team December 14, 2024 04:39 PM UTC

Hi Yang Eric Lu,

 

We have confirmed the issue as "Exception is thrown while parsing an empty vmlDrawing file" and logged a defect report. We will include the fix for this issue in our upcoming weekly NuGet release scheduled for December 31, 2024.

 

You can track the status of the defect report through feedback link.

 

 

Regards,

Atchaya S.



EL Eric Liu replied to Atchaya Sekar December 16, 2024 01:53 AM UTC

Hi Atchaya


Great to hear this!


Thanks for your prompt reply and looking forward for this release!


Just confirm one more thing, this release will be targeted for .net framework 4.8 as well for .net core 6.0 (linux), yes?


BR

Eric



YV Yaavann Vignesh Sethuraman Syncfusion Team December 17, 2024 04:51 AM UTC

Hi Yang Eric Lu,

Yes, The fix will be included in the upcoming release and will be compatible with both .NET Framework 4.8 and .NET Core 6.0 (Linux).


Regards,
Yaavann.



EL Eric Liu replied to Yaavann Vignesh Sethuraman December 18, 2024 05:50 AM UTC

Thanks, Yaavann


BR

Eric



AH Alex Harson James Henso Syncfusion Team December 31, 2024 09:02 AM UTC

Hi Yang Eric Lu,

 

We apologize for the inconvenience caused. Unfortunately, we are unable to include this fix in today's weekly release. However, we will include it in the upcoming weekly release scheduled for Jan 07, 2025.

 

Thank you for your patience and understanding.

 

Regards,
Alex Harson James H



ZS Zhenya Skoblina January 7, 2025 10:34 AM UTC

Hi! Was the fix included in todays release (28.1.38)? Should we expect it to work even with .net8?



ZS Zhenya Skoblina January 8, 2025 08:24 AM UTC

Hi again, I can still reproduce the issue with latest build 28.1.38. Was the problem fixed?



AS Atchaya Sekar Syncfusion Team January 8, 2025 03:17 PM UTC

Hi Zhenya,

 

We apologize for the inconvenience. We were unable to include the fix in this week's release. However, the fix will be included in our upcoming weekly release scheduled for January 14, 2024. In the meantime, we appreciate your understanding.

 

Regards,

Atchaya S.



EL Eric Liu January 15, 2025 01:34 AM UTC

Hi Atchaya, Is there any update on the fix? Thanks!



AS Atchaya Sekar Syncfusion Team January 16, 2025 02:27 PM UTC

Hi Eric,

 

We appreciate your patience.

 

We have included the fix to resolve the issue "Exception is thrown while parsing an empty vmlDrawing file" in our weekly NuGet release version 28.1.39. Kindly upgrade your Syncfusion packages to this new 28.1.39 version and let us know if the issue is resolved.

 

NuGet Package: NuGet Gallery | Syncfusion.XlsIO.WinForms 28.1.39

 

 

Root cause for this issue:

While parsing a vmlDrawing if vmlDrawing is empty, XlsIO doesn't handle which causes an exception to be thrown

 

Regards

Atchaya S.


Loader.
Up arrow icon