获取数据透视表的外部连接数据源
Contents
[
Hide
]
如何获取数据透视表的外部连接数据源
Aspose.Cells为Python via .NET提供了获取数据透视表的外部连接数据源的功能。为此,API提供了external_connection_data_source类的PivotTable属性。external_connection_data_source属性返回ExternalConnection对象。以下代码片段演示了使用PivotTable.external_connection_data_source属性获取数据透视表的外部连接数据源的用法。
示例代码
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
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# Source directory | |
sourceDir = RunExamples.Get_SourceDirectory() | |
# Load sample file | |
workbook = Workbook(sourceDir + "SamplePivotTableExternalConnection.xlsx") | |
worksheet = workbook.worksheets[0] | |
# Get the pivot table | |
pivotTable = worksheet.pivot_tables[0] | |
# Print External Connection Details | |
print("External Connection Data Source") | |
print("Name: " + pivotTable.external_connection_data_source.name) | |
print("Type: " + str(pivotTable.external_connection_data_source.type)) |
代码片段中使用的源文件已附上供参考。