0

I am trying to export excel workbook to PDF using introp libraries, but i am getting this exception HRESULT: 0x800A03EC

I am using office 2010 libraries, this exception is thrown on line below

xlNewWorkBook.ExportAsFixedFormat(XlFixedFormatType.xlTypePDF,
 userSpecificFile, missing, missing, missing, missing, missing, missing,
missing);

Here is the StackTrace

Microsoft.Office.Interop.Excel.WorkbookClass.ExportAsFixedFormat(XlFixedFormatType Type, Object Filename, Object Quality, Object IncludeDocProperties, Object IgnorePrintAreas, Object From, Object To, Object OpenAfterPublish, Object FixedFormatExtClassPtr) XLEZClient.DAL.SqlServer.UpdateRepository.getPopulatedBook(List`1& FIDSNSIModel, String& fileName, Boolean isMultipleBooks, String& userId) C:\Users\Administrator\Desktop\XLEZ Latest SRC_DataHandler\DAL\SqlServer\UpdateRepository.cs:行 937

Addy
  • 2,608
  • 10
  • 52
  • 98

1 Answers1

1

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.

You can read more about that in the Considerations for server-side Automation of Office article. Use any third-party components designed for the server-side execution instead.

Eugene Astafiev
  • 26,795
  • 2
  • 13
  • 31