Elimina la tabella pivot da un foglio di lavoro
Contents
[
Hide
]
Aspose.Cells for Node.js via C++ offre una funzione per eliminare o rimuovere la tabella pivot da un foglio di lavoro. È possibile eliminare la tabella pivot utilizzando l’oggetto tabella pivot o la sua posizione. Si prega di usare il metodo Worksheet.getPivotTables().remove(pivotTable) per eliminare la tabella pivot utilizzando l’oggetto tabella pivot e il metodo Worksheet.getPivotTables().removeAt(index, keepData) per eliminarlo usando la sua posizione all’interno della collezione di tabelle pivot.
Come eliminare la tabella pivot dal foglio di lavoro usando Aspose.Cells for Node.js via C++
Il codice di esempio seguente elimina due tabelle pivot dal foglio di lavoro. Prima rimuove la tabella pivot utilizzando il metodo Worksheet.getPivotTables().remove(pivotTable) e poi rimuove la tabella pivot utilizzando il metodo Worksheet.getPivotTables().removeAt(index, keepData)
This file contains hidden or 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
const AsposeCells = require("aspose.cells.node"); | |
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
var dataDir = RunExamples.GetDataDir("."); | |
// Create workbook object from source Excel file | |
var workbook = new AsposeCells.Workbook(dataDir + "source.xlsx"); | |
// Access the first worksheet | |
var worksheet = workbook.getWorksheets().get(0); | |
// Access the first pivot table object | |
var pivotTable = worksheet.getPivotTables().get(0); | |
// Remove pivot table using pivot table object | |
worksheet.getPivotTables().remove(pivotTable); | |
// OR you can remove pivot table using pivot table position by uncommenting below line | |
//worksheet.getPivotTables().removeAt(0); | |
// Save the workbook | |
workbook.save(dataDir + "output_out.xlsx"); |