Error when exporting report to XLSX: a generic error occurred in GDI+

4 posts, 0 answers
  1. Erik
    Erik avatar
    15 posts
    Member since:
    Jun 2018

    Posted 02 Jul 2020 Link to this post

    (Test carried out using the BarcodeTypes demo report)

    On my development machine, all export formats work fine.

    When deployed to Azure, some formats work, some don't:

    _ PDF, CSV, XLS, Tiff & MHTML all work fine

    _ XLSX, PowerPoint, RTF and Word all give the same GDI+ error

    I have found other instances of GDI+ errors on the forum (related to PictureBox, PDF export, ...) but this seems to be a different type of exception

     

    I am aware of Report Export issues on Azure with cheap plans, and have upgraded to a higher plan (Basic); PDF export didn't work on cheaper plan and that works now, so I assume this is an unrelated issue.

    Error message:

    w3wp.exe Error: 0 : An error occurred while rendering the report in separate thread: System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.
       at System.Drawing.Imaging.Metafile..ctor(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, String desc)
       at System.Drawing.Imaging.Metafile..ctor(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type)
       at Telerik.Reporting.Processing.Imaging.ImageUtils.CreateMetafileCore(Size sizePx) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\Processing\Imaging\ImageUtils.Full.cs:line 105
       at Telerik.Reporting.Processing.Imaging.ImageUtils.CreateMetafileImage(SizeF sizeMm) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\Processing\Imaging\ImageUtils.Full.cs:line 91
       at Telerik.Reporting.Processing.Imaging.MetafileImageFactory.CreateImage(SizeF sizeMm) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\Processing\Imaging\ImageFactory.cs:line 26
       at Telerik.Reporting.ExcelRendering.Barcode.RenderInternal(IWorksheet worksheet, RenderingContext context) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\ExcelRendering\Barcode.cs:line 21
       at Telerik.Reporting.ExcelRendering.RenderingItem.Render(IWorksheet worksheet, RenderingContext context) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\ExcelRendering\RenderingItem.cs:line 364
       at Telerik.Reporting.ExcelRendering.RenderingItemContainer.RenderInternal(IWorksheet worksheet, RenderingContext context) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\ExcelRendering\RenderingItemContainer.cs:line 108
       at Telerik.Reporting.ExcelRendering.Table.RenderInternal(IWorksheet worksheet, RenderingContext context) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\ExcelRendering\Table.cs:line 31
       at Telerik.Reporting.ExcelRendering.RenderingItem.Render(IWorksheet worksheet, RenderingContext context) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\ExcelRendering\RenderingItem.cs:line 364
       at Telerik.Reporting.ExcelRendering.RenderingItemContainer.RenderInternal(IWorksheet worksheet, RenderingContext context) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\ExcelRendering\RenderingItemContainer.cs:line 108
       at Telerik.Reporting.ExcelRendering.Section.RenderInternal(IWorksheet worksheet, RenderingContext context) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\ExcelRendering\Section.cs:line 26
       at Telerik.Reporting.ExcelRendering.RenderingItem.Render(IWorksheet worksheet, RenderingContext context) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\ExcelRendering\RenderingItem.cs:line 364
       at Telerik.Reporting.ExcelRendering.Group.RenderInternal(IWorksheet worksheet, RenderingContext context) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\ExcelRendering\Group.cs:line 47
       at Telerik.Reporting.ExcelRendering.RenderingItem.Render(IWorksheet worksheet, RenderingContext context) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\ExcelRendering\RenderingItem.cs:line 364
       at Telerik.Reporting.ExcelRendering.RenderingItemContainer.RenderInternal(IWorksheet worksheet, RenderingContext context) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\ExcelRendering\RenderingItemContainer.cs:line 108
       at Telerik.Reporting.ExcelRendering.Report.RenderInternal(IWorksheet worksheet, RenderingContext context) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\ExcelRendering\Report.cs:line 202
       at Telerik.Reporting.ExcelRendering.RenderingItem.Render(IWorksheet worksheet, RenderingContext context) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\ExcelRendering\RenderingItem.cs:line 364
       at Telerik.Reporting.ExcelRendering.Report.Render(IWorkbook workbook) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\ExcelRendering\Report.cs:line 137
       at Telerik.Reporting.OpenXmlRendering.Spreadsheet.SpreadsheetReport.Telerik.Reporting.Processing.IRenderingExtension.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting.OpenXmlRendering\Spreadsheet\SpreadsheetReport.cs:line 40
       at Telerik.Reporting.Processing.ReportProcessor.RenderCore(ExtensionInfo extensionInfo, IList`1 processingReports, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\Processing.ReportProcessor\ReportProcessor.RenderReport.cs:line 236
       at Telerik.Reporting.Processing.ReportProcessor.RenderCore(String format, IList`1 reports, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\Processing.ReportProcessor\ReportProcessor.RenderReport.cs:line 157
       at Telerik.Reporting.Services.Engine.ReportRenderer.Render(ReportRendererArgs args) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\Services.Engine\ReportRenderer.cs:line 40
       at Telerik.Reporting.Services.Engine.Rendering.RenderWithCulture(ReportRendererArgs args) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\Services.Engine\Rendering.cs:line 152
       at Telerik.Reporting.Services.Engine.Rendering.ThreadFunc(Object o) in c:\temp\reporting\RBuild-23266\Reporting_Build\Source\Code\Telerik.Reporting\Services.Engine\Rendering.cs:line 120

     

     

    Any hep would be greatly appreciated,

     

    Erik

  2. Zach
    Zach avatar
    1 posts
    Member since:
    Feb 2021

    Posted 17 Feb in reply to Erik Link to this post

    Greetings from Germany,

    Erik, did you find the solution? I worked with the EPPlus .xlsx files (running in Azure). And the process produced “A generic error occurred in GDI+”

    Zach Swedberg

     

    docs.telerik.com/import-and-export-to-excel-file-formats/xlsx/xlsxformatprovider writemyessaysonline.com

  3. Neli
    Admin
    Neli avatar
    386 posts

    Posted 19 Feb Link to this post

    Hi Zach,

    I noticed that the provided link was from the Document processing documentation. Can you please confirm that the problem is related to Telerik Reporting and the issue is reproducible when you try to run the hosted reports on Azure?

    The Exception "A generic error occurred in GDI+" is thrown by the Graphics Device Interface (GDI) that we use internally to measure and render the items in our reports. It is a very general error and informs that the GDI processor cannot resolve an item - image, character, icon, etc.

    Because the application is hosted in Azure, please, check GDI+ error or OutOfMemoryException on exporting or printing Telerik report from Azure WebSites KB article.

    Regards,
    Neli
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

  4. Richard
    Richard avatar
    4 posts
    Member since:
    Jul 2020

    Posted 26 Feb Link to this post

    I had the same issue and adding this to app.settings fixed it:

     

      "telerikReporting": {
        "extensions": [
          {
            "name": "DOCX",
            "parameters": [
              {
                "Name": "UseMetafile",
                "Value": "false"
              }
            ]
          },
          {
            "name": "XLSX",
            "parameters": [
              {
                "Name": "UseMetafile",
                "Value": "false"
              }
            ]
          },
          {
            "name": "PPTX",
            "parameters": [
              {
                "Name": "UseMetafile",
                "Value": "false"
              }
            ]
          },
          {
            "name": "RTF",
            "parameters": [
              {
                "Name": "UseMetafile",
                "Value": "false"
              }
            ]
          }

        ]
      },

Back to Top