在将Excel转换为PDF时呈现实线网格线

Contents
[ ]

为了与旧版本兼容,Aspose.Cells在将Excel转换为PDF时默认将网格线呈现为虚线。然而,现代Excel通常将网格线呈现为实线。

使用 PdfSaveOptions.GridlineTypes 选项,Aspose.Cells 也能够将网格线渲染为实线。

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Create an empty Workbook
Workbook wb = new Workbook();
//Prepare data
wb.Worksheets[0].Cells["D9"].PutValue("gridline");
//Enable to print gridline
wb.Worksheets[0].PageSetup.PrintGridlines = true;
//Set to render gridline as solid line
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.GridlineType = GridlineType.Hair;
// Save the pdf file with PdfSaveOptions
wb.Save(TMP_DIR + "test_Cs.pdf", pdfSaveOptions);

solid-gridline.png