Uso de estilos integrados
Contents
[
Hide
]
Aspose.Cells proporciona una amplia colección de estilos reutilizables para formatear una celda en un documento de hoja de cálculo. Podemos usar estilos incorporados en nuestro libro de trabajo y también crear estilos personalizados.
Cómo usar estilos integrados
El métodoWorkbook.createBuiltinStyle y claseBuiltinStyleTypeque sea conveniente crear estilos reutilizables. Aquí hay una lista de todos los estilos incorporados posibles:
- 20_POR CIENTO_ACENTO_1
- 20_POR CIENTO_ACENTO_2
- 20_POR CIENTO_ACENTO_3
- 20_POR CIENTO_ACENTO_4
- 20_POR CIENTO_ACENTO_5
- 20_POR CIENTO_ACENTO_6
- CUARENTA_POR CIENTO_ACENTO_1
- CUARENTA_POR CIENTO_ACENTO_2
- CUARENTA_POR CIENTO_ACENTO_3
- CUARENTA_POR CIENTO_ACENTO_4
- CUARENTA_POR CIENTO_ACENTO_5
- CUARENTA_POR CIENTO_ACENTO_6
- SESENTA_POR CIENTO_ACENTO_1
- SESENTA_POR CIENTO_ACENTO_2
- SESENTA_POR CIENTO_ACENTO_3
- SESENTA_POR CIENTO_ACENTO_4
- SESENTA_POR CIENTO_ACENTO_5
- SESENTA_POR CIENTO_ACENTO_6
- ACENTO_1
- ACENTO_2
- ACENTO_3
- ACENTO_4
- ACENTO_5
- ACENTO_6
- MALO
- CÁLCULO
- CHECK_CELL
- COMA
- COMA_1
- DIVISA
- MONEDA_1
- TEXTO_EXPLICATIVO
- BUENO
- CABECERA_1
- CABECERA_2
- CABECERA_3
- CABECERA_4
- HIPERVÍNCULO
- SEGUIDO_HIPERVINCULO
- APORTE
- LINKED_CELL
- NEUTRAL
- NORMAL
- NOTA
- PRODUCCIÓN
- POR CIENTO
- TÍTULO
- TOTAL
- ADVERTENCIA_TEXTO
- ROW_LEVEL
- COLUMN_LEVEL
El código siguiente muestra cómo usar estilos integrados.
This file contains hidden or 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 | |
String dataDir = Utils.getDataDir(UsingBuiltinStyles.class); | |
String output1Path = dataDir + "Output.xlsx"; | |
String output2Path = dataDir + "Output.ods"; | |
Workbook workbook = new Workbook(); | |
Style style = workbook.createBuiltinStyle(BuiltinStyleType.TITLE); | |
Cell cell = workbook.getWorksheets().get(0).getCells().get("A1"); | |
cell.putValue("Aspose"); | |
cell.setStyle(style); | |
workbook.getWorksheets().get(0).autoFitColumn(0); | |
workbook.getWorksheets().get(0).autoFitRow(0); | |
workbook.save(output1Path); | |
System.out.println("File saved " + output1Path); | |
workbook.save(output2Path); | |
System.out.println("File saved " + output2Path); |