How can I build a project containing Excel creation in VSTS?

邮差的信 提交于 2019-12-11 17:04:04

问题


I have a project that uses Interop Excel to build up a report. This runs just fine and the report is created every time.

The problem that I'm facing now is when published, I'm not able to run it, it is built and published but I get an exception when I try to create the Excel file with this line:

var excelApp = new Excel.Application();

The exception is the one below, I've added multiple references to assemblies but I'm not sure if maybe I'm missing some COM reference for this to run.

Unhandled Exception: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).


回答1:


After all, Azure app service does not allow Office. The way I took was OpenXML.

In short, we can't use it on the Azure WebApp service. There is no MS Office inter-op present on Azure WebApp service and Azure WebApp is sandbox. If we want to write and read excel file on the Azure WebApp, we could use the DocumentFormat.OpenXml as workaround.



来源:https://stackoverflow.com/questions/50277686/how-can-i-build-a-project-containing-excel-creation-in-vsts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!