【问题标题】:Converting WORD doc to PDF after using as template into Microsoft.Office.Interop.Word.Application() in c# win form在 c# win 表单中作为模板使用 Microsoft.Office.Interop.Word.Application() 后将 WORD doc 转换为 PDF
【发布时间】:2019-03-20 07:35:34
【问题描述】:

**这是一个特殊情况。我已将 word doc 用作 Microsoft.Office.Interop.Word.Application() 的模板,并在所有操作结束时在我的应用程序中使用它,我想将此使用过的文档 doc 转换为 PDF。我必须将我在给定代码中显示的“文档”文档转换为 PDF。这对我来说非常重要,请帮助我。谢谢**

 var application = new Microsoft.Office.Interop.Word.Application();
var document = new Microsoft.Office.Interop.Word.Document();
 document = application.Documents.Add(Template: ConnectDb.filepath);

【问题讨论】:

标签: c# .net winforms ado.net


【解决方案1】:

有一个名为“Spire”的工具可以将您的 Word 转换为 PDF。

您可以将其安装为 NuGet 包。

Spire Website

Example of Converting Word to PDF using Spire

【讨论】:

  • 尊敬的先生,我已经知道我们使用字符串路径进行转换。问题是我们在下面的Given中使用该字符串
  • document = application.Documents.Add(Template: ConnectDb.filepath);
  • 在上面的代码行中,现在这个文档不再只有字符串了。它把整个模板放在里面。因此,当我使用“文档”用于 covvering 时会出现错误。我需要你的帮助
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-11-20
  • 2023-02-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多