The Workbook.Worksheets.PivotTables.Add method contains 8 overloads, one of which is the following:
public int Add(string[] sourceData, bool isAutoPage, PivotPageFields pageFields, int row, byte column, string tableName)
Could you provide an example of how to call this method in .NET where isAutoPage is set to False? My issue is that I see no way of creating or retrieving a PivotPageFields object to pass to this method.
String[] sourceData = new String[]{"=Sheet1!A1:C8","=Sheet2!A1:C8"}; PivotPageFields pageField = new PivotPageFields(); String[] pageItems = new String[2]; pageItems[0] = "Item1"; pageItems[1] = "Item2"; pageField.AddPageField(pageItems); pageItems = new String[2]; pageItems[0] = "Item3"; pageItems[1] = "Item4"; pageField.AddPageField(pageItems); int[] sxTBPG = new int[2];
sxTBPG[0] = 0; sxTBPG[1] = 1;
//Sets which item label in each page field to use to identify the data range. pageField.AddIdentify(0,sxTBPG); sxTBPG = new int[2]; sxTBPG[0] = 1; sxTBPG[1] = -1; pageField.AddIdentify(1,sxTBPG); int index = pivotTables.Add(sourceData,false,pageField,"E3","PivotTable1");