Page tree

Versions Compared

Key

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

...

RowLabels and ColumnLabels

Adding a pivot table field - row labels / column labels, source fields, naming convention, changing the display nameSimilarly to page fields, RowLabels and ColumnLabels are created on the PivotTable.RowLabels and PivotTable.ColumnLabels collections. As mentioned earlier, only one RowLabel, ColumnLabel, or PageField can be created from a particular SourceField.

Code Block

Insert column label and row label code here

Excel automatically sorts and re-renders a PivotTable any time a change is made. By default, the row label or column label values are sorted alpha-numerically in ascending order.

Since ExcelWriter does not have the ability to render PivotTables or sort the values for a field, the only way to guarantee that the data will be sorted is to set RefreshOnOpen to true and set SortOptions to be Ascending, Descending.

Code Block

Insert code to sort the row label and column label values here

When Excel refreshes the PivotTable, the

DataFields

Adding data fields - calculated fields, naming conventions, changing the display name

...