[英]If pivot table/range is added to Data Model, how to get the the source of pivot table in C#?
例如,如果源是 Excel 表,我使用 pivotTableObj.SourceData 我想使用 C# 代码刷新 Pivot 表。 pivotTableObj.SourceData doesn't work if table/range is not added to Excel Data Model I am using checkbox from Insert>>Pivot Table dialog box - "Add this data to data model" to add Excel table to Data model
if (pivotTable.PivotCache().OLAP == true)
{
ModelTables modelTable;
modelTable = MyWorkbook.Model.ModelTables;
foreach(ModelTable modelTable in modelTables)
{
//my purpose was to refresh the pivot table
//printing just a name for instance
System.Windows.Forms.MessageBox.Show(modelTable.Name);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.