Rimozione dell'affettatrice
Contents
[
Hide
]
Rimozione dell’affettatrice
Per rimuovere l’affettatrice in Microsoft Excel, è sufficiente selezionare l’affettatrice e premere il tastoElimina pulsante. Per ottenere il salvataggio utilizzando Aspose.Cells for Python via Java, utilizzare il metodo Worksheet.getSlicers().remove(). Rimuoverà l’affettatrice dal foglio di lavoro.
Il seguente frammento di codice carica il fileesempio di file Excelche contiene un’affettatrice esistente. Accede all’affettatrice, lo rimuove e salva il filefile Excel di output. Lo screenshot seguente mostra l’affettatrice che verrà rimossa.
Codice d’esempio
This file contains 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
import jpype | |
import asposecells | |
jpype.startJVM() | |
from asposecells.api import Workbook, SaveFormat | |
# Load Source Excel file | |
workbook = Workbook("sampleRemovingSlicer.xlsx") | |
# Access first worksheet | |
worksheet = workbook.getWorksheets().get(0) | |
# Access the newly added slicer from slicer collection | |
slicer = worksheet.getSlicers().get(0) | |
# Remove slicer | |
worksheet.getSlicers().remove(slicer) | |
# Save the workbook in output XLSX format | |
workbook.save("outputRemovingSlicer.xlsx", SaveFormat.XLSX) | |
jpype.shutdownJVM() |