Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Signature
vb.net
vb.net
Public Property ReportLayout() As LayoutOption
Example
Code Block
csharp
csharp
titleC#
          ExcelApplication xla = new ExcelApplication();
          Workbook wb = xla.Open(@"C:\MySpreadsheet.xlsx");
          Worksheet ws = wb.Worksheets[0];
          PivotTableLayout.LayoutOption layout = ws.PivotTables[0].PivotTableLayout.ReportLayout;
          ws.PivotTables[0].PivotTableLayout.ReportLayout = PivotTableLayout.LayoutOption.Tabular;
        
Code Block
vbnet
vbnet
titlevb.net
          Dim xla As New ExcelApplication()
          Dim wb As Workbook = xla.Open("C:\MySpreadsheet.xlsx")
          Dim ws As Worksheet = wb.Worksheets(0)
          Dim layout As PivotTableLayout.LayoutOption = ws.PivotTables(0).PivotTableLayout.ReportLayout
          ws.PivotTables(0).PivotTableLayout.ReportLayout = PivotTableLayout.LayoutOption.Tabular
        
Remarks

This property corresponds to the PivotTable layout options under PivotTable Layout on the Design tab. Together with the PivotTableSettings.ClassicLayout property this enables the ability to drag and drop fields in the PivotTable grid.

The default layout value of is Compact for PivotTables generated by ExcelWriter.