ピボットテーブルの外部接続データソースの取得
Contents
[
Hide
]
ピボットテーブルの外部接続データソースの取得
Aspose.Cells は、ピボットテーブルの外部接続データソースを取得する機能を提供しています。そのために、API は ExternalConnectionDataSource クラスの PivotTable プロパティを提供します。ExternalConnectionDataSource プロパティは ExternalConnection オブジェクトを返します。次のコードスニペットは、PivotTable.ExternalConnectionDataSource プロパティを使用してピボットテーブルの外部接続データソースを取得する方法を示しています。
サンプルコード
This file contains 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
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Source directory | |
string sourceDir = RunExamples.Get_SourceDirectory(); | |
// Load sample file | |
Workbook workbook = new Workbook(sourceDir + "SamplePivotTableExternalConnection.xlsx"); | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Get the pivot table | |
var pivotTable = worksheet.PivotTables[0]; | |
// Print External Connection Details | |
Console.WriteLine("External Connection Data Source"); | |
ExternalConnection[] connections = pivotTable.GetSourceDataConnections(); | |
foreach(ExternalConnection conn in connections) | |
{ | |
Console.WriteLine("Name: " + conn.Name); | |
Console.WriteLine("Type: " + conn.SourceType); | |
} |
コードスニペットで使用されるソースファイルは、参照用に添付されています。