J
Jim
Hello,
I'm trying to turn off Excel 2002 PivotTable Subtotals
using C#.NET. I'm able to set other field properties, but
I cannot figure out how to use the set_Subtotals method or
locate that .Subtotals property that so many Excel 97
programming examples use. Sample of my attached code
below. Any help would be greatly appreciated.
Thanks,
Jim
Excel._Workbook oWB;
Excel._Worksheet
oSheet;
Excel.PivotCache
pivotCache;
Excel.PivotTable
pivotTable;
Excel.PivotField
pivotField;
string
sourceData;
Excel.Range
oRng;
oWB = mXL.Workbook;
oSheet = (Excel.Worksheet)
oWB.Sheets.Add(Type.Missing, Type.Missing, Type.Missing,
Type.Missing);
oRng = oSheet.get_Range
("A7","A7").Cells;
Excel.PivotCaches pivotCaches =
oWB.PivotCaches();
sourceData = "Data!R1C1:R" +
mLastRow + "C" + mLastCol;
pivotCache = pivotCaches.Add
(Excel.XlPivotTableSourceType.xlDatabase, sourceData);
pivotTable =
pivotCache.CreatePivotTable(oRng, "Flow-Through",
Type.Missing,
Excel.XlPivotTableVersionList.xlPivotTableVersionCurrent);
pivotTable.SmallGrid = false;
// Pivot Table Page Area
pivotField = (Excel.PivotField)
pivotTable.PivotFields("Region");
pivotField.Orientation =
Excel.XlPivotFieldOrientation.xlPageField;
pivotField.Position = 1;
pivotField = (Excel.PivotField)
pivotTable.PivotFields("Opportunity Owner");
pivotField.Orientation =
Excel.XlPivotFieldOrientation.xlPageField;
pivotField.Position = 1;
// Pivot Table Row Area
pivotField = (Excel.PivotField)
pivotTable.PivotFields("Account Name");
pivotField.Orientation =
Excel.XlPivotFieldOrientation.xlRowField;
pivotField.Position = 1;
I'm trying to turn off Excel 2002 PivotTable Subtotals
using C#.NET. I'm able to set other field properties, but
I cannot figure out how to use the set_Subtotals method or
locate that .Subtotals property that so many Excel 97
programming examples use. Sample of my attached code
below. Any help would be greatly appreciated.
Thanks,
Jim
Excel._Workbook oWB;
Excel._Worksheet
oSheet;
Excel.PivotCache
pivotCache;
Excel.PivotTable
pivotTable;
Excel.PivotField
pivotField;
string
sourceData;
Excel.Range
oRng;
oWB = mXL.Workbook;
oSheet = (Excel.Worksheet)
oWB.Sheets.Add(Type.Missing, Type.Missing, Type.Missing,
Type.Missing);
oRng = oSheet.get_Range
("A7","A7").Cells;
Excel.PivotCaches pivotCaches =
oWB.PivotCaches();
sourceData = "Data!R1C1:R" +
mLastRow + "C" + mLastCol;
pivotCache = pivotCaches.Add
(Excel.XlPivotTableSourceType.xlDatabase, sourceData);
pivotTable =
pivotCache.CreatePivotTable(oRng, "Flow-Through",
Type.Missing,
Excel.XlPivotTableVersionList.xlPivotTableVersionCurrent);
pivotTable.SmallGrid = false;
// Pivot Table Page Area
pivotField = (Excel.PivotField)
pivotTable.PivotFields("Region");
pivotField.Orientation =
Excel.XlPivotFieldOrientation.xlPageField;
pivotField.Position = 1;
pivotField = (Excel.PivotField)
pivotTable.PivotFields("Opportunity Owner");
pivotField.Orientation =
Excel.XlPivotFieldOrientation.xlPageField;
pivotField.Position = 1;
// Pivot Table Row Area
pivotField = (Excel.PivotField)
pivotTable.PivotFields("Account Name");
pivotField.Orientation =
Excel.XlPivotFieldOrientation.xlRowField;
pivotField.Position = 1;