将带有图片和图表的 XLS 文件转换为 PDF
Contents
[
Hide
]
Aspose.Cells支持将包含图像和图表的XLS文件转换为PDF文档。 Aspose.Cells for Java 可独立工作以将电子表格转换为PDF:不需要使用Aspose.PDF API来进行转换。
该过程可在内存中进行,不依赖临时或中间 XML 文件。这意味着大型 Excel 文件(例如含有图片、图表和其他绘图对象的文件)可快速高效地转换。
如果电子表格中包含公式,最好在转换为 PDF 前调用 Workbook.calculateFormula 方法。这样做可以确保重新计算公式依赖的值,并在 PDF 中呈现正确的值。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(ConvertXLSFileToPDF.class); | |
//Create a new Workbook | |
Workbook book = new Workbook(dataDir + "SampleInput.xlsx"); | |
//Save the excel file to PDF format | |
book.save(dataDir + "output.pdf", SaveFormat.PDF); |