【问题标题】:SharePoint 2010 Word automation service and Event ReceiverSharePoint 2010 Word 自动化服务和事件接收器
【发布时间】:2018-03-11 00:47:48
【问题描述】:

我正在开发 SharePoint 2010 事件接收器。我在特定列表上运行此事件接收器,并且在某些条件下,我在库中创建 word 文档的副本并使用动态值编辑其属性,然后使用 word 自动化服务将此文档转换为同一库中的 PDF。

我的 word 文档是正确创建的,并且在 word 文档中插入了所需的文档属性。代码正确执行,但文档未转换为 PDF。

以下是转换代码:

using (SPSite spSite = new SPSite("http://MySharePoint Site"))
            {

                SPServiceContext serviceContext = SPServiceContext.GetContext(spSite.WebApplication.ServiceApplicationProxyGroup, SPSiteSubscriptionIdentifier.Default);

                var wordAutomationProxy = (WordServiceApplicationProxy)serviceContext.GetDefaultProxy(typeof(WordServiceApplicationProxy));

                //Defines a collection of settings for all conversions within a single conversion job.
                ConversionJobSettings jobSettings = new ConversionJobSettings();
                jobSettings.OutputFormat = SaveFormat.PDF;
                //Represents a collection of file conversions (of single files or entire libraries) that share a common set of conversion properties and are logically tracked as a single unit.
                ConversionJob pdfConversion = new ConversionJob(wordAutomationProxy, jobSettings);
              // Set the credentials to use when running the conversion job.
                pdfConversion.UserToken = spSite.UserToken;                    
                pdfConversion.AddFile(DocFilePath, PDFFilePath);
                pdfConversion.Start();

}

【问题讨论】:

标签: c# ms-word sharepoint-2010 pdf-generation eventreceiver


【解决方案1】:

我重新创建了自动化服务这个词,这解决了我的问题。没有代码更改。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多