Best Fit
- 2 minutes to read
PivotGridControl provides the capability to automatically calculate and apply the optimal width/height required for a column/row to completely display its contents.
#Best Fit Overview
The Best Fit feature can be applied to an individual column or row, as well as to all columns and rows displayed within the PivotGridControl.
Use the PivotGridControl.BestFitArea (PivotGridField.BestFitArea) property to specify interface elements (field headers, field values or cells) that should be taken into account when adjusting column widths and row heights.
If cell values are taken into account when calculating the optimal width of a column (or the height of a row), you can specify the way this width/height is calculated. To do this, use the PivotGridControl.BestFitMode (PivotGridField.BestFitMode) property. By default, the column's width (or the row's height) is calculated based on the text of all cells within this column (or row).
To increase the application performance, the number of cells taken into account when calculating the optimal width/height can be limited by setting the PivotGridControl.BestFitMaxRowCount (PivotGridField.BestFitMaxRowCount) property. By default, this property is set to -1, to indicate that all cells are processed. If the PivotGridControl.BestFitMaxRowCount property is set to a positive value, the PivotGridControl processes the specified number of cells starting from the first visible cell (top visible, for columns, and leftmost visible, for rows).
The following table lists methods used to apply the Best Fit feature:
Method | Description |
---|---|
Depending on the particular overload, applies the Best Fit:
| |
Resizes the specified column to the minimum width required to completely display its contents. | |
Resizes the specified row to the minimum height required to completely display its contents. |
Note that the Best Fit feature cannot be applied within the PivotGridControl.BeginUpdate and PivotGridControl.EndUpdate method calls.
NOTE
The Best Fit feature cannot be applied to the pivot grid if the Pivot
The Best Fit is available only after the Pivot
#End-User Capabilities
End-users can resize columns to their optimal width (if allowed) by double clicking the right border. Rows are resized by double clicking the bottom border.