积极答复者
Save Excel as PDF

问题
-
I want to export excel and save as PDF ..
When I run this code:
workbook.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF, filePath+".pdf" ,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);
in server,it throw a exception:
The remote procedure call failed. (Exception from HRESULT: 0x800706BE)
I debug in local is ok!!!!
Help!!!!!!
Ellis_Wong
- 已编辑 Ellis_wong 2013年8月14日 6:45
答案
-
Sorry for the delay.
If it is office 2010, the add-in is installed by default.
Another possibility is that you didn't install any printer on your server. Please check if Microsoft XPS Document Writer is installed. ExportAsFixedFormat method will call the printer when you want to convert your excel file to pdf file. Set this printer as default.
Caillen
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.- 已标记为答案 Barry WangModerator 2013年8月27日 5:53
全部回复
-
What's the operating system of this server? Did you have the newest service package installed? And please check if the server and your local machine are all 32 bit or 64bit.
It seems to be a problem about the server system but not your code since it works fine in local machine. Please take a look at this thread:http://www.lansweeper.com/forum/yaf_postst635_the-remote-procedure-call-failed-exception-from-hresult-0x800706be.aspx
If you're developing a Web Application to run in IIS on the server, I'm afraid the functionality may not be implemented. Please refer to this thread:http://stackoverflow.com/questions/9591087/exporting-excel-file-to-pdf-getting-stuck-trying-to-close-excel-file
Caillen
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help. -
Are you working on Office 2007 or later version?
Please make sure you've installed the SaveAsPDFandXPS plug in on your server. Free download from here:http://www.microsoft.com/en-us/download/details.aspx?id=7
Caillen
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- 已标记为答案 Barry WangModerator 2013年8月27日 5:52
- 取消答案标记 Barry WangModerator 2013年8月27日 5:53
-
Sorry for the delay.
If it is office 2010, the add-in is installed by default.
Another possibility is that you didn't install any printer on your server. Please check if Microsoft XPS Document Writer is installed. ExportAsFixedFormat method will call the printer when you want to convert your excel file to pdf file. Set this printer as default.
Caillen
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.- 已标记为答案 Barry WangModerator 2013年8月27日 5:53