Formatage de la trancheuse

Formatage d’un tronçonneur

Avec Microsoft Excel, vous pouvez formater le filtre en définissant son nombre de colonnes, ses styles, etc. Aspose.Cells for Python via Java fournit les propriétés Slicer.NumberOfColumns et Slicer.StyleType pour y parvenir.

Le code suivant charge le fichier Excel exemple qui contient un filtre. Il accède au filtre, définit son nombre de colonnes et son type de style, puis l’enregistre sous le nom de fichier Excel de sortie. La capture d’écran montre à quoi ressemble le filtre après l’exécution du code exemple.

todo:image_alt_text

Code d’exemple

import jpype
import asposecells
jpype.startJVM()
from asposecells.api import Workbook, SaveFormat, SlicerStyleType
# Load Source Excel file
workbook = Workbook("sampleFormattingSlicer.xlsx")
# Access first worksheet
worksheet = workbook.getWorksheets().get(0)
# Access the newly added slicer from slicer collection
slicer = worksheet.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
workbook.save("outputFormattingSlicer.xlsx", SaveFormat.XLSX)
jpype.shutdownJVM()