Questo rapido tutorial spiega come collegare lo slicer a più tabelle pivot usando Java. All details will be provided to connect a slicer to multiple pivot tables using Java with the help of a set of steps and IDE settings. Vari miglioramenti saranno inoltre condivisi alla fine dell’articolo per migliorare il codice di esempio fornito durante la creazione del file Excel.
Steps to use a single slicer for multiple pivot tables with Java
- Configure the IDE to use Aspose.Cells for Java to connect a slicer.
- Create a workbook, access a worksheet, and add header rows and sample data to it.
- Create the first PivotTable, add it to the worksheet pivot table collection using getPivotTables().add()
- Configure the PivotTable above and set the row and data fields.
- Create another PivotTable from the pivot table above to share the same data cache.
- Update and calculate both pivot tables to make them ready for connection to the slicer.
- Usa il metodo getSlicers().add() per aggiungere un slicer per la prima PivotTable
- Call the addPivotConnection() method to connect the slicer to the second pivot table.
- Save the resulting workbook with the pivot tables and the slicer inside it.
I passaggi sopra riassumono come ottenere un slicer collegato a più tabelle pivot usando Java. Create a workbook, access a worksheet, add a sample row and its data, create a pivot table, and add it to the worksheet. Creare la seconda tabella pivot dalla prima per condividere la cache comune, eseguire il calcolo delle tabelle pivot e aggiornarle prima di aggiungere una connessione slicer, aggiungere la connessione slicer e salvare il file Excel di output.
Codice per collegare un filtro a più tabelle pivot usando Java
Questo codice ha dimostrato l’uso di Excel slicer per più tabelle pivot usando Java. You should refresh the workbook/worksheet whenever possible instead of refreshing individual pivot tables. Add all the necessary slicer display options by setting the integrated stylus, along with the caption setting, the number of columns, the row height, and the column width.
This article taught us the process for linking a slicer to pivot tables. To convert an Excel file to Markdown format, see the article Convert Excel to Markdown using Java.