Page tree

Versions Compared

Key

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

...

Code Block
pivot.PageFields.CreateField(dateStart);
pivot.PageFields.CreateField(dateEnd);
Info

Page fields are The layout of the page fields depends on whether the page layout is set to 'Down, then Over' or 'Over, then Down' and the number of fields allowed per row/column. These properties are not exposed in the current API, so the defaults apply when creating a PivotTable from scratch. The defaults are 'Down, then Over' and an unlimited number of fields per column.

This means that in PivotTables created by ExcelWriter, page fields are always placed starting two rows above the upper left corner of the PivotTable, so if a PivotTable is placed in cell B10, then page fields will start in B8. Any additional page fields are added to B8 and existing page fields are moved up, or the new page field is added to a column to the right, depending on the page layout properties in the PivotTable.

By default, all the page fields appear in one column.

If there is no space to add the page fields above the PivotTable (i.e. the PivotTable is located in cell A1), then ExcelWriter will automatically move the PivotTable down to accommodate the page fields.

...