使用Microsoft Office 2013标准版将单词转换为pdf时出错 [英] Error while converting word to pdf using Microsoft office 2013 standard edition

查看:119
本文介绍了使用Microsoft Office 2013标准版将单词转换为pdf时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我们正在尝试将word文档转换为PDF,并且能够使用<$ p $在Microsoft Office 2007专业设置的登台服务器上执行相同操作p> ExportAsFixedFormat

方法来自

 Microsoft.Office.Interop.Word.Document 

来自以下代码:



 wordDocument.ExportAsFixedFormat(paramExportFilePath,
paramExportFormat,paramOpenAfterExport,
paramExportOptimizeFor,paramExportRange,paramStartPage,
paramEndPage,paramExportItem,paramIncludeDocProps,
paramKeepIRM, paramCreateBookmarks,paramDocStructureTags,
paramBitmapMissingFonts,paramUseISO19005_1,
ref paramMissing);





但是它不能用于生产使用Microsoft Office 2013标准版的服务器,并在运行fr时给出以下错误om IIS:



检索CLSID为{000209FF-0000-0000-C000-000000000046}的组件的COM类工厂失败,原因如下错误:80070005访问被拒绝。 (HRESULT异常:0x80070005(E_ACCESSDENIED))。





我不确定这是否是由于办公室设置不同或我们需要添加任何加载项?



我们也尝试过赋予DCOM配置权限。



请协助。





提前致谢。



什么我试过了:



我们尝试过赋予DCOM配置权

解决方案

您不应该以这种方式使用Office Interops,MS不支持将其用作网站的一部分&他们不推荐,参考;

服务器的注意事项 - 方自动化办公室 [^]

具体请参阅使用服务器端自动化Office 部分,因为这清楚地描述了您遇到问题的原因,特别是有关用户身份的问题,您的网站很可能在没有用户配置文件的帐户下运行,因此办公室将无法正常工作。解决这个问题是可能的,但不是正确的答案



亲切的问候


Hi,

We are trying to convert word document to PDF and able to do the same on staging server with Microsoft office 2007 professional setup using

ExportAsFixedFormat

method from

Microsoft.Office.Interop.Word.Document 

from below code :

wordDocument.ExportAsFixedFormat(paramExportFilePath,
                            paramExportFormat, paramOpenAfterExport,
                            paramExportOptimizeFor, paramExportRange, paramStartPage,
                            paramEndPage, paramExportItem, paramIncludeDocProps,
                            paramKeepIRM, paramCreateBookmarks, paramDocStructureTags,
                            paramBitmapMissingFonts, paramUseISO19005_1,
                            ref paramMissing);



However it is not working on production server with Microsoft Office 2013 standard edition and gives below error upon running from IIS :

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).



I am not sure if this is due to office setup difference or we need to add any add-in ?

We have tried giving rights to DCOM config as well.

Please assist.


Thanks in advance.

What I have tried:

We have tried giving rights to DCOM config 

解决方案

You should not be using the Office Interops in this way, MS does not support their use as part of a web site & they are not recommended, refer;
Considerations for server-side Automation of Office[^]
Refer specifically to the section Problems using server-side Automation of Office as this clearly describes why you are having issues, specifically regarding User Identity, your website is likely running under an account that does not have a user profile, hence office will not work correctly. Working around this is possible but not the correct answer

Kind Regards


这篇关于使用Microsoft Office 2013标准版将单词转换为pdf时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆