What is the C# code to Display Excel Pivot Table layout in Tabular Form?
Here is the code from the Macro that I need converted to C#:
ActiveSheet.PivotTables("PivotTable1").RowAxisLayout xlTabularRow
Here is my starting code to show what variables I have set up:
//Excel.Application excel = new Excel.Application();
activeWorkBook = excel.ActiveWorkbook;
sheets = excel.Sheets;
pivotWorkSheet = (Excel.Worksheet)sheets.Add();
// Create the Pivot Table
pivotCaches = activeWorkBook.PivotCaches();
pivotCache = pivotCaches.Create(Excel.XlPivotTableSourceType.xlDatabase,"Sheet1!$A$2:$J$35");
pivotTable = pivotCache.CreatePivotTable("Sheet2!R2C1");
// Set the Pivot Fields
pivotFields = (Excel.PivotFields)pivotTable.PivotFields();
我弄清楚了,以防万一其他人正在寻找我使用过的东西:
pivotTable.RowAxisLayout(Excel.XlLayoutRowType.xlTabularRow);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.