Docx到PDF的转换 [英] Docx to PDF conversion
问题描述
大家好
我已经通过OpenXML创建了Microsoft 2007 docx输出,但是现在我想将此输出更改为PDF格式.
Docx包含页眉,页脚,带有图形图像的各种页面以及过多的格式.
因此,请提出我是否有可能仅通过更改标题即可将docx转换为pdf.
使用:Visual Studio 2010 Ultimate
3.5框架
和C#.net用于网站项目.
以下是我尝试执行的代码:
Hi All
I had created a Microsoft 2007 docx output via OpenXML but now i want to change this output in PDF format.
Docx contain header,footer,various pages with graphical images as well as too much formatting.
So please suggest is there any possibility that I can convert the docx to pdf just by changing the Headers.
Using :Visual Studio 2010 Ultimate
3.5 framework
and C#.net for website project.
Below is the code which I tried to do the same:
//Creating new name and making .PDF
var resultname = Server.MapPath("App_data/doc/" + timeSpan + ".pdf");
//Here filename is a buffer or original word document.
using (var mainDoc = WordprocessingDocument.Open(filename, false))
using (var resultDoc = WordprocessingDocument.Create(resultname,WordprocessingDocumentType.Document))
{
foreach (var part in mainDoc.Parts)
resultDoc.AddPart(part.OpenXmlPart, part.RelationshipId);
}
但这使我无法打开文件,可能已损坏.
请建议....
在此先感谢!!
问候
Mahendra Varandani
But it is giving me Unable to open file,Might corrupt.
Please suggest....
Thanks in Advance!!
Regards
Mahendra Varandani
推荐答案
开发者,
谢谢你的建议..
但是它是一个付费的dll,.net中是否有任何未付费/免费的解决方案?
还是做同一件事的最佳方法是...就像我已经准备好创建docx一样.
Hi devpeter,
Thanks for suggestion..
But it a paid dll is there any unpaid/free solution in .net??
or what would be the best approach to do the same...as If I have created my docx ready.
这篇关于Docx到PDF的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!