EPPlus, running in Azure produces "A generic error occurred in GDI+" EPPlus, running in Azure produces "A generic error occurred in GDI+" azure azure

EPPlus, running in Azure produces "A generic error occurred in GDI+"


This is not possible using the current versions of EPPlus, due to a dependency on the System.Drawing libraries internally.

See here for an official thread on the topic:https://github.com/JanKallman/EPPlus/issues/427

And here for some other interesting reading: https://photosauce.net/blog/post/5-reasons-you-should-stop-using-systemdrawing-from-aspnet

It seems like the only way through this will be to identify the functions in EPP that depend on System.Drawing and work around them. Or adjust EPP to use a different library for graphics.

This may be a good start for you to begin determining the parts you can avoid: https://github.com/JanKallman/EPPlus/search?q=%22using+system.drawing%3B%22&unscoped_q=%22using+system.drawing%3B%22


I typically use EPPlus in this way:

  1. Grab a template.xlsx I have previously formatted
  2. Add data to it (using C# and EPPlus)
  3. Return the new xlsx to the user

I recently had the same error:

A generic error occurred in GDI+

How it was solved:

My template.xlsx was using Excel's Camera Tool: that is, there was a snapshot in one of the sheets that was being pasted in another sheet.

This works fine locally (in my computer) but not in Azure... I don't know why.

But if I remove the snapshot it works