在将Excel转换为PDF时呈现实线网格线
Contents
[
Hide
]
为了与旧版本兼容,Aspose.Cells在将Excel转换为PDF时默认将网格线呈现为虚线。然而,现代Excel通常将网格线呈现为实线。
使用选项PdfSaveOptions.GridlineTypes,Aspose.Cells还可以将网格线呈现为实线。
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 | |
// Create an empty Workbook | |
Workbook wb = new Workbook(); | |
//Prepare data | |
wb.getWorksheets().get(0).getCells().get("D9").putValue("gridline"); | |
//Enable to print gridline | |
wb.getWorksheets().get(0).getPageSetup().setPrintGridlines(true); | |
//Set to render gridline as solid line | |
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions(); | |
pdfSaveOptions.setGridlineType(GridlineType.HAIR); | |
// Save the pdf file with PdfSaveOptions | |
wb.save("output.pdf", pdfSaveOptions); |