Hämta extern anslutningsdatakälla för pivottabell

Hur man får extern anslutningsdatakälla för pivot-tabell

Aspose.Cells for Node.js via C++ ger möjlighet att hämta den externa anslutningsdatakällan för pivottabellen. För detta tillhandahåller API:et getExternalConnectionDataSource metoden för PivotTable klassen. getExternalConnectionDataSource metoden returnerar ExternalConnection objektet. Följande kodsnutt visar hur man använder getExternalConnectionDataSource metoden för att hämta den externa anslutningskällan för pivottabellen.

Exempelkod

const AsposeCells = require("aspose.cells.node");
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Source directory
var sourceDir = RunExamples.Get_SourceDirectory();
// Load sample file
var workbook = new AsposeCells.Workbook(sourceDir + "SamplePivotTableExternalConnection.xlsx");
var worksheet = workbook.getWorksheets().get(0);
// Get the pivot table
var pivotTable = worksheet.getPivotTables().get(0);
// Print External Connection Details
console.log("External Connection Data Source");
console.log("Name: " + pivotTable.getExternalConnectionDataSource().getName());
console.log("Type: " + pivotTable.getExternalConnectionDataSource().getType());

Källfilen som används i kodprovet är bifogad för referens.

Källfil