Renderizar líneas de cuadrícula sólidas al convertir Excel a PDF con Python.NET

Contents
[ ]

Para compatibilidad con versiones anteriores, Aspose.Cells renderiza las líneas de cuadrícula como líneas punteadas por defecto al convertir Excel a PDF. Sin embargo, los Excel modernos renderizan las líneas de cuadrícula como líneas sólidas hoy en día.

Con la opción PdfSaveOptions.gridline_type, Aspose.Cells también puede renderizar las líneas de cuadrícula como líneas sólidas.

import os
from aspose.cells import Workbook, PdfSaveOptions, GridlineType

# Create an empty Workbook
wb = Workbook()

# Prepare data
worksheet = wb.worksheets[0]
worksheet.cells.get("D9").put_value("gridline")

# Enable to print gridline
worksheet.page_setup.print_gridlines = True

# Set to render gridline as solid line
pdf_save_options = PdfSaveOptions()
pdf_save_options.gridline_type = GridlineType.HAIR

# Save the pdf file with PdfSaveOptions
current_dir = os.path.dirname(os.path.abspath(__file__))
output_dir = os.path.join(current_dir, "output")

if not os.path.exists(output_dir):
    os.makedirs(output_dir)

wb.save(os.path.join(output_dir, "test_Cs.pdf"), pdf_save_options)

solid-gridline.png