2011-03-22 160 views

回答

2

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

我发现这对another website希望它帮助。似乎基于可用于办公室保存为PDF的插件。

'另存为PDF' 插件 的Office 2007,看看这个链接

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

的2007 Microsoft Office加载项: 微软另存为PDF - 下载链接

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

一旦你下载这个地址,我认为 你应该b能够使用.NET中的Word对象转换为PDF 。

否则,你有一个第三方组件 以.NET编写这确实 为你,但评价 版本产生的 转换文档水印,请检查下面 链接,如果你准备购买 它,那么你可以用它在你的 vb.net/c#.net代码文档转换为PDF

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

1

使用关Ice Interop在Word/Excel中打开文档,并发布为PDF(如果您有2007)或使用CutePDF Writer或类似的东西打印。

1

您可以使用Spire.Xls和Spire.Doc来执行此操作。

以下是示例代码。

//xls to pdf   
    Workbook workbook = new Workbook(); 
    workbook.LoadFromFile("sample.xlsx", ExcelVersion.Version2007); 
    PdfConverter pdfConverter = new PdfConverter(workbook); 

    PdfDocument pdfDocument = new PdfDocument(); 
    pdfDocument.PageSettings.Orientation = PdfPageOrientation.Landscape; 
    pdfDocument.PageSettings.Width = 970; 
    pdfDocument.PageSettings.Height = 850; 

    PdfConverterSettings settings = new PdfConverterSettings(); 
    settings.TemplateDocument = pdfDocument; 
    pdfDocument = pdfConverter.Convert(settings); 
    pdfDocument.SaveToFile("test.pdf"); 

    //doc to pdf 
    Document doc = new Document(); 
    doc.LoadFromFile("sample.docx", FileFormat.Docx); 
    doc.SaveToFile("test.pdf", FileFormat.PDF);