InteropServices.COMException in ExportAsFixedFormat but only in Windows 10

2

I'm developing a winform that maps XML data to an Excel template file. The XML map is set in the Excel template.

Then, I export the Excel to PDF:

Application xApp = new Application();
Workbook excelWorkBook = xApp.Workbooks.Open(@"" + ExcelTMPLPath, Type.Missing, false);   
excelWorkBook.XmlMaps["NewDataSet_Map"].Import(TransXMLFilePath);

excelWorkBook.ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, PDFOUTPUTFilePath, XlFixedFormatQuality.xlQualityStandard, true);

excelWorkBook.Close();
xApp.Workbooks.Close();

This is working on multiple Windows 7 machines, with both Excel 2013 and 2016.

But on two Windows 10 laptops, it's giving the following error during the ExportAsFixedFormat call:

"System.Runtime.InteropServices.COMException (0x80010105): The server threw an exception. (Exception from HRESULT:0x80010105 (RPC_E_SERVERFAULT))"

I'm confused because it's mentioning a server but this is all run locally on the machine. Even more confused because it was working on the Windows 10 machines up until a couple of weeks ago.

However, if I use an Excel file with no XML mapping at all, it works and exports it to PDF, so it seems like an issue with the XML mapping. But it's strange that this wouldn't work in Windows 10.

Does anyone have a clue as to what could be the issue, and what might be a solution?

Thank you in advance!

c#
xml
winforms
asked on Stack Overflow Jul 19, 2017 by jtk90

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0