Questo breve tutorial descrive come aggiungere subtotale in Excel usando Java. You will get information to set up the development environment, a list of programming steps, and sample code to create subtotals in Excel. Further details will be discussed to improve the code and create custom outputs by adding a subtotal to an Excel file.
Passaggi per creare subtotali automatici con Java
- Customize the IDE to use Aspose.Cells for Java to create a subtotal in Excel
- Create a Workbook object and obtain a reference to the first Worksheet to add data to it.
- Add the header labels in the first row of the worksheet.
- Set the sample data in a 2D array grouped by region and fill the worksheet with the 2D data.
- Set the data range, call the subtotal API for grouping, and calculate the sum.
- Set the option for outline to display subtotal rows beneath the related detail rows.
- Per visualizzare solo le righe di subtotale, comprimi le righe di dettaglio raggruppate per tutte le righe del foglio di lavoro
- Adatta automaticamente le colonne e salva la cartella di lavoro sul disco
Questi passaggi descrivono come creare subtotali in Excel usando Java. Create a workbook object, access the first worksheet, add sample headers, create sample grouped data, and insert the data into the sheet under the respective headers. Define the range and header row, apply a subtotal, set the subtotal to display below the detail rows, collapse the outline levels to customize the resulting Excel file, and save the workbook to disk.
Codice per creare subtotali automatici in Excel usando Java
This code has demonstrated how to create subtotals in Excel using Java. È possibile ordinare i dati per colonna di gruppo prima del subtotale, impostare l’intervallo dinamico e scegliere tra varie opzioni di subtotale, come l’uso della sovraccarico con replace, pageBreaks e il riepilogo sotto i dati per controllare il comportamento del subtotale. È possibile aggiungere più colonne di subtotale in una singola cella, e possono essere utilizzate diverse funzioni di consolidamento, ad esempio COUNT, AVERAGE e MAX, dove necessario.
This article guided us in working with subtotals in an Excel file. To link a slicer to multiple pivot tables, refer to the article Link slicer to multiple pivot tables using Java.