ColumnBase.PrintWidth Property
Gets or sets the column width (in pixels) when you print or export GridControl to PDF, XLSX/XLS, or DOCX/DOC. This is a dependency property.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v25.2.Core.dll
NuGet Package: DevExpress.Wpf.Grid.Core
Declaration
Property Value
| Type | Default | Description |
|---|---|---|
| Double | double.NaN | The column width (in pixels) when you print or export GridControl to PDF, Excel, or Word. |
Remarks
If the PrintWidth property is set to double.NaN (default), the printing engine determines the target width automatically as follows:
- Uses the current on-screen column width.
- Calculates the width required to fit header/values in full if the column is not visible on-screen for any reason.
Behavior
The PrintWidth property behaves as follows:
- Affects all ColumnBase descendants (for example, GridColumn, TreeListColumn ).
- If explicitly specified, has priority over FixedWidth and PrintAutoWidth properties.
- Cannot be used on bands directly. You can specify the
PrintWidthproperty for individual columns within a band. - Has no effect on the grid layout displayed on-screen; used only during export and print operations.
- Is not supported in CardView.
- Is not applied when exporting to CSV.
- Does not support the
*value.
Example: Specify Fixed Column Width
The following example specifies fixed widths for Email and Name columns:
<dxg:GridControl>
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="Email" Header="Email Address" PrintWidth="300"/>
<dxg:GridColumn FieldName="Name" Header="Full Name" PrintWidth="200"/>
</dxg:GridControl.Columns>
</dxg:GridControl>
Print Width for Bands
You cannot specify the PrintWidth property for bands. Use GridColumn.PrintWidth within a GridControlBand instead.
The following example creates a GridControlBand with two rows. The second row (370px + 100px = 470px) is wider than the first row (70px + 180px = 250px). To maintain visual consistency in the exported layout, the GridControlBand proportionally stretches the first row to match the width of the second row:
<dxg:GridControlBand Header="Customer Details">
<dxg:GridColumn FieldName="Birthday" PrintWidth="70" dxg:BandBase.GridRow="0"/>
<dxg:GridColumn FieldName="Phone" PrintWidth="180" dxg:BandBase.GridRow="0"/>
<dxg:GridColumn FieldName="Address" PrintWidth="370" dxg:BandBase.GridRow="1"/>
<dxg:GridColumn FieldName="Balance" PrintWidth="100" dxg:BandBase.GridRow="1"/>
</dxg:GridControlBand>
The GridControlBand extends the first row so that both rows inside the band occupy the same total width (470px) and ensures that the band’s border retains its alignment in the exported document.