Search code examples
azureoffice365azure-functionsazure-webjobs

Creating PDF or excel from azure webjob or azure function every 10 mins


There is a requirement to create password protected excel or PDF on storage from azure webjob or function every 10 minutes. I have been trying few options but could not find a suitable one.

  1. I thought of using Open XML SDK for excel but found difficult to create styles, charts in it as we have little time to implement.
  2. Thought of using report viewer which will convert report to PDF in webjob, I have not yet fully explored as reportviewer needs to be installed from marketpalce. Whenever I udpate Visual Studio it create issues.
  3. Not sure if Excel's interop will work. We have office 365 in case anyone has pointers.

Could you please appropriate option where I can write something to call multiple APIs to geneate excel/report and convert that to password protected PDF.


Solution

  • No matter what way you go, if you're using charts you're going to run into trouble because of the Azure sandbox which has now been aggressively expanded so that EPPlus as an example (basically all of them have this issue) fails on basic functions, and even save if there is a chart in the Excel file.

    The reason why is because the Sandbox that these are running in is incredibly limited on what GDI+ functions it will allow which means most of the System.Drawing.Common namespace in .NET won't work as an example and anything else that uses these same Win32 calls will also be blocked.

    So far I've yet to find a viable solution that doesn't use System.Drawing.Common to accomplish what you're looking for.