如何在C#中将.docx转换为.pdf
发布时间:2020-12-15 08:01:09 所属栏目:百科 来源:网络整理
导读:现在我们使用Open XML从数据库中读取数据并生成doc.但最终的要求是成为pdf.所以我想知道如何在C#中将.docx转换为pdf.有人可以帮忙吗?或者提供一些信息. 解决方法 您可以在此链接中查看解决方案: http://www.codeproject.com/Questions/346784/How-to-conve
现在我们使用Open
XML从数据库中读取数据并生成doc.但最终的要求是成为pdf.所以我想知道如何在C#中将.docx转换为pdf.有人可以帮忙吗?或者提供一些信息.
解决方法
您可以在此链接中查看解决方案:
http://www.codeproject.com/Questions/346784/How-to-convert-word-document-to-pdf-in-Csharp
我建议首先在解决方案中使用它: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Microsoft.Office.Interop.Word; public partial class Default2 : System.Web.UI.Page { protected void Page_Load(object sender,EventArgs e) { Microsoft.Office.Interop.Word.Application appWord = new Microsoft.Office.Interop.Word.Application(); wordDocument = appWord.Documents.Open(@"D:desktopxxxxxx.docx"); wordDocument.ExportAsFixedFormat(@"D:desktopDocTo.pdf",WdExportFormat.wdExportFormatPDF); } public Microsoft.Office.Interop.Word.Document wordDocument { get; set; } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |