Skip to main content
 首页 » 编程设计

c#之如何使用 C# 从 Word/Excel 文件生成 Pdf 文件

2024年02月23日19qq号

我想从 Word 文档(.doc、.docx)或 excel 文档(.xls、.xlsx)生成 PDF 文件。 我尝试使用 ITextSharp,但无法将 word 文档的图像/表格等渲染到 ​​pdf 中。

请您参考如下方法:

这是一个 example of opening the word file using interops in VS2010 C#

我在 another website 上找到了这个希望能帮助到你。似乎是基于可用于 office 另存为 PDF 的插件。

'Save as PDF' add-on for Office 2007, check out this link

http://news.com.com/Microsoft+delivers+Save+as+PDF+add-on/2100-1012_3-6114752.html

2007 Microsoft Office Add-in: Microsoft Save as PDF - download link

http://www.microsoft.com/downloads/details.aspx?familyid=F1FC413C-6D89-4F15-991B-63B07BA5F2E5&displaylang=en

Once you download this Addin, I think you should be able to conver to PDF using Word Objects in .NET.

Otherwise,you have a third party component written in .net which does that for you, but the evaluation version produces a watermark in the converted documents, check the below link and if you are ready to purchase it then you can use it in your vb.net/c#.net code to convert doc to pdf

http://www.aspose.com/Wiki/default.aspx/Aspose.Pdf/WordToPDF.html