【问题标题】:Excel to PDF conversion using spire library使用 spire 库将 Excel 转换为 PDF
【发布时间】:2017-04-03 10:49:10
【问题描述】:

我正在尝试使用 spirepdf 库将 excel 数据转换为 pdf,但是 excel 的内容(特别是如果 excel 中存在边框)与页脚页码重叠,我试图更新页脚的宽度但问题仍然是相同的。有什么建议吗?

【问题讨论】:

    标签: c# excel pdf


    【解决方案1】:

    据我所知,Spire.XLS 库允许将 excel 转换为 pdf,但 Spire.PDF 库不允许。您能确认您使用的是哪个库吗?如果是 Spire.XLS,那么您可以尝试设置 PDF 页面的高度,如下代码所示。

           Workbook workbook = new Workbook();
           workbook.LoadFromFile("D:\\test.xlsx");
    
           PdfDocument pdfDocument = new PdfDocument();
           pdfDocument.PageSettings.Orientation = PdfPageOrientation.Landscape;
           pdfDocument.PageSettings.Width = 970;
           pdfDocument.PageSettings.Height = 850;
    
           PdfConverter pdfConverter = new PdfConverter(workbook);
           PdfConverterSettings settings = new PdfConverterSettings();
           settings.TemplateDocument = pdfDocument;
           pdfDocument = pdfConverter.Convert(settings);
    
           pdfDocument.SaveToFile("sample.pdf");
    

    您可以查看Excel to PDF in C#, VB.NET 文章了解详细信息。 希望我正确理解了您的意图。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-26
      • 2017-01-13
      • 2018-01-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-16
      • 2018-02-03
      相关资源
      最近更新 更多