wpf-devexpress-dot-xpf-dot-grid-dot-columnbase-b7bcc08c.md
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
public double PrintWidth { get; set; }
Public Property PrintWidth As Double
| Type | Default | Description |
|---|---|---|
| Double | double.NaN |
The column width (in pixels) when you print or export GridControl to PDF, Excel, or Word.
|
If the PrintWidth property is set to double.NaN ( default ), the printing engine determines the target width automatically as follows:
The PrintWidth property behaves as follows:
PrintWidth property for individual columns within a band.* value.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>
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.
See Also