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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

130280 May 4,2017 05:08 AM UTC Nov 29,2018 07:36 AM UTC ASP.NET Web Forms 3
loading
Tags: XlsIO
Andre Freitag
Asked On May 4, 2017 05:08 AM UTC

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

Abirami Varadharajan [Syncfusion]
Replied On 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.  


Mischa
Replied On 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

Prakash Kumar D [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;