We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

XlsIO on Azure: 'A generic error occurred in GDI+' when loading .xlsx with embedded .emf graphics

Hi,

it seems that XlsIO (from Syncfusion.AspNet.Mvc5.FileFormats 15.1.0.41) is unable to open an .xlsx file with an embedded .emf image on Microsoft Azure.

ExcelEngine.Workbooks.Open throws a System.Runtime.InteropServices.ExternalException stating 'A generic error occurred in GDI+' when trying to do so (example .xlsx see attachment).

Is there anything I can do about it? Like disabling the loading of graphics or similar? If not, any chance you will address this problem?


Thanks in advance

André


PS: stack trace

System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
   at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
   at System.Drawing.Image.Save(Stream stream, ImageFormat format)
   at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoBitmapPicture.EvaluateHash()
   at Syncfusion.XlsIO.Parser.Biff_Records.MsoDrawing.MsoBitmapPicture.set_Picture(Image value)
   at Syncfusion.XlsIO.Implementation.WorkbookShapeDataImpl.AddPicture(Image image, ExcelImageFormat imageFormat, String strPictureName)
   at Syncfusion.XlsIO.Implementation.Shapes.BitmapShapeImpl.set_Picture(Image value)
   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseBlipTag(XmlReader reader, BitmapShapeImpl shape, RelationCollection relations, String strParentPath, FileDataHolder holder, List`1 lstRelationIds, Dictionary`2 dictItemsToRemove)
   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseBlipFill(XmlReader reader, BitmapShapeImpl shape, RelationCollection relations, String parentPath, FileDataHolder holder, List`1 lstRelationIds, Dictionary`2 dictItemsToRemove)
   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParsePicture(XmlReader reader, WorksheetBaseImpl sheet, String drawingsPath, List`1 lstRelationIds, Dictionary`2 dictItemsToRemove)
   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseTwoCellAnchor(XmlReader reader, WorksheetBaseImpl sheet, String drawingsPath, List`1 lstRelationIds, Dictionary`2 dictItemsToRemove)
   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseDrawings(XmlReader reader, WorksheetBaseImpl sheet, String drawingsPath, List`1 lstRelationIds, Dictionary`2 dictItemsToRemove)
   at Syncfusion.XlsIO.Implementation.XmlSerialization.WorksheetDataHolder.ParseDrawings(WorksheetBaseImpl sheet, Relation drawingRelation, Dictionary`2 dictItemsToRemove)
   at Syncfusion.XlsIO.Implementation.XmlSerialization.WorksheetDataHolder.ParseDrawings(WorksheetBaseImpl sheet, String relationId, Dictionary`2 dictItemsToRemove)
   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseDrawings(XmlReader reader, WorksheetBaseImpl sheet, Dictionary`2 dictItemsToRemove)
   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseAfterSheetData(XmlReader reader, WorksheetImpl sheet, MemoryStream& streamCF, String strParentPath, Dictionary`2 dictItemsToRemove)
   at Syncfusion.XlsIO.Implementation.XmlReaders.Excel2007Parser.ParseSheet(XmlReader reader, WorksheetImpl sheet, String strParentPath, MemoryStream& streamStart, MemoryStream& streamCF, List`1 arrStyles, Dictionary`2 dictItemsToRemove, Dictionary`2 dictUpdatedSSTIndexes)
   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.ParseStream(Stream stream, String password, ExcelVersion version, ExcelParseOptions options)
   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, ExcelVersion version, ExcelParseOptions options)
   at Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(Stream stream, ExcelOpenType openType)
   at TestController.<Post>d__1.MoveNext()

Attachment: IncludesEmf.xlsx_9e040c02.zip

3 Replies

AV Abirami Varadharajan Syncfusion Team May 5, 2017 02:27 PM UTC

Hi Andre,  
  
We are able to reproduce the issue “GDI Exception thrown while opening the file in Azure”. A support incident to track the status of this issuehas been created under your account. Please log on to our support website to check for further updates.   
    
   
Please let us know if you have any concerns.  
  
Regards,  
Abirami.  



MI Mischa November 28, 2018 01:01 PM UTC

Hi,

Did you ever get around to fixing this? Because I just got the same situation (GDI+ error on Azure) on 16.3.0.36


PK Prakash Kumar D Syncfusion Team November 29, 2018 07:36 AM UTC

Hi Mischa, 
 
Thank you for using Syncfusion products. 
 
You can avoid this exception by enabling the property EnablePartialTrustCode . Please find the code snippet below  
 
Code Example: 
 
ExcelEngine excelEngine = new ExcelEngine(); 
IApplication application = excelEngine.Excel; 
//For Azure platform 
application.EnablePartialTrustCode = true; 
 
 
To know more about this, kindly refer the following KB link 
 
Regards, 
Prakash Kumar 


Loader.
Live Chat Icon For mobile
Up arrow icon