Back to Devexpress

PivotBehaviorOptions.AutoFitColumns Property

officefileapi-devexpress-dot-spreadsheet-dot-pivotbehavioroptions.md

latest5.3 KB
Original Source

PivotBehaviorOptions.AutoFitColumns Property

Gets or sets a value indicating whether column widths should be automatically resized when the pivot table is recalculated or refreshed.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
bool AutoFitColumns { get; set; }
vb
Property AutoFitColumns As Boolean

Property Value

TypeDescription
Boolean

true , to automatically adjust column widths each time the pivot table is updated; otherwise, false.

The default value is true.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to AutoFitColumns
PivotTable

.Behavior .AutoFitColumns

|

Remarks

By default, when you change your PivotTable report (add, move or remove fields, change the report layout, apply filters etc.) or perform a refresh operation, column widths in the pivot table are automatically resized to fit the cell content. To preserve the column widths so that they don’t change when the pivot table is recalculated or refreshed, set the AutoFitColumns property to false.

The following code snippets (auto-collected from DevExpress Examples) contain references to the AutoFitColumns property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-spreadsheet-pivot-table-api-examples/CS/SpreadsheetWPFPivotTableExamples/CodeExamples/PivotTableActions.cs#L145

csharp
PivotBehaviorOptions behaviorOptions = pivotTable.Behavior;
behaviorOptions.AutoFitColumns = false;
behaviorOptions.EnableFieldList = false;

winforms-spreadsheet-pivot-table-api/CS/SpreadsheetPivotTableExamples/CodeExamples/PivotTableActions.cs#L139

csharp
PivotBehaviorOptions behaviorOptions = pivotTable.Behavior;
behaviorOptions.AutoFitColumns = false;
behaviorOptions.EnableFieldList = false;

spreadsheet-document-api-pivot-table-examples/CS/SpreadsheetDocServerPivotAPI/CodeExamples/PivotTableActions.cs#L149

csharp
PivotBehaviorOptions behaviorOptions = pivotTable.Behavior;
behaviorOptions.AutoFitColumns = false;
behaviorOptions.EnableFieldList = false;

wpf-spreadsheet-pivot-table-api-examples/VB/SpreadsheetWPFPivotTableExamples/CodeExamples/PivotTableActions.vb#L139

vb
Dim behaviorOptions As PivotBehaviorOptions = pivotTable.Behavior
behaviorOptions.AutoFitColumns = False
behaviorOptions.EnableFieldList = False

winforms-spreadsheet-pivot-table-api/VB/SpreadsheetPivotTableExamples/CodeExamples/PivotTableActions.vb#L133

vb
Dim behaviorOptions As PivotBehaviorOptions = pivotTable.Behavior
behaviorOptions.AutoFitColumns = False
behaviorOptions.EnableFieldList = False

spreadsheet-document-api-pivot-table-examples/VB/SpreadsheetDocServerPivotAPI/CodeExamples/PivotTableActions.vb#L136

vb
Dim behaviorOptions As PivotBehaviorOptions = pivotTable.Behavior
behaviorOptions.AutoFitColumns = False
behaviorOptions.EnableFieldList = False

See Also

PivotBehaviorOptions Interface

PivotBehaviorOptions Members

DevExpress.Spreadsheet Namespace