Formato de filtro

Escenarios de uso posibles

Puede dar formato al filtro en Microsoft Excel configurando su número de columnas o su estilo, etc. Aspose.Cells también le permite hacer esto utilizando las propiedades Slicer.NumberOfColumns y Slicer.StyleType.

** Formatear rebanador**

Consulte el siguiente código, carga el archivo de Excel de ejemplo que contiene un filtro. Accede al filtro y establece su número de columnas y tipo de estilo y lo guarda como archivo de Excel de salida. La captura de pantalla muestra cómo se ve el filtro después de la ejecución del código de ejemplo.

todo:image_alt_text

Código de muestra

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// Load sample Excel file containing slicer.
Workbook wb = new Workbook(srcDir + "sampleFormattingSlicer.xlsx");
// Access first worksheet.
Worksheet ws = wb.getWorksheets().get(0);
// Access the first slicer inside the slicer collection.
Slicer slicer = ws.getSlicers().get(0);
// Set the number of columns of the slicer.
slicer.setNumberOfColumns(2);
// Set the type of slicer style.
slicer.setStyleType(SlicerStyleType.SLICER_STYLE_LIGHT_6);
// Save the workbook in output XLSX format.
wb.save(outDir + "outputFormattingSlicer.xlsx", SaveFormat.XLSX);