C# 透视表报表布局以表格形式显示
以表格形式显示Excel数据透视表布局的C代码是什么 下面是我需要转换为C#的宏代码: 下面是我的开始代码,显示我设置了哪些变量:C# 透视表报表布局以表格形式显示,c#,excel,pivot-table,tabular,C#,Excel,Pivot Table,Tabular,以表格形式显示Excel数据透视表布局的C代码是什么 下面是我需要转换为C#的宏代码: 下面是我的开始代码,显示我设置了哪些变量: //Excel.Application excel = new Excel.Application(); activeWorkBook = excel.ActiveWorkbook; sheets = excel.Sheets; pivotWorkSheet = (Excel.Worksheet)sheets.Add(); // Create the Pivot
//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);
pivotTable.RowAxisLayout(Excel.XlLayoutRowType.xlTabularRow);