【问题标题】:Pivot Table Report layout Show in Tabular Form数据透视表报表布局以表格形式显示
【发布时间】:2014-08-11 17:23:59
【问题描述】:

以表格形式显示 Excel 数据透视表布局的 C# 代码是什么?

这是我需要转换为 C# 的宏中的代码:

ActiveSheet.PivotTables("PivotTable1").RowAxisLayout xlTabularRow

这是我设置的变量的起始代码:

//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();

【问题讨论】:

    标签: c# excel pivot-table tabular


    【解决方案1】:

    我想出了以防其他人正在寻找我使用的这个:

      pivotTable.RowAxisLayout(Excel.XlLayoutRowType.xlTabularRow);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-28
      • 2012-05-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-01
      相关资源
      最近更新 更多