Exportar Excel a HTML con Líneas de Cuadrícula
Exportar Excel a HTML con Líneas de Cuadrícula
El siguiente código de muestra crea un libro y llena su hoja de trabajo con algunos valores y luego lo guarda en formato HTML después de establecer la propiedad HtmlSaveOptions.ExportGridLines en true.
La siguiente captura de pantalla muestra el HTML generado con este código de muestra. Como puede ver, también muestra las líneas de cuadrícula en el HTML de salida.
// 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(ExportExceltoHTML.class); | |
// Create your workbook | |
Workbook wb = new Workbook(); | |
// Access first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
// Fill worksheet with some integer values | |
for (int r = 0; r < 10; r++) { | |
for (int c = 0; c < 10; c++) { | |
ws.getCells().get(r, c).putValue(r * 1); | |
} | |
} | |
// Save your workbook in HTML format and export gridlines | |
HtmlSaveOptions opts = new HtmlSaveOptions(); | |
opts.setExportGridLines(true); | |
wb.save(dataDir + "output.html", opts); |