获取数据透视表的外部连接数据源

如何获取数据透视表的外部连接数据源

Aspose.Cells for Node.js via C++ 提供了获取数据透视表外部连接数据源的能力。为此,API 提供了 getExternalConnectionDataSource 方法,该方法属于 PivotTable 类。getExternalConnectionDataSource 方法返回 ExternalConnection 对象。以下代码片段演示了如何使用 getExternalConnectionDataSource 方法获取数据透视表的外部连接数据源。

示例代码

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());

代码片段中使用的源文件已附上供参考。

源文件