Skip to main content

DxGridDataColumn.ExportWidth Property

Specifies the column’s export width.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(200)]
[Parameter]
public int ExportWidth { get; set; }

Property Value

Type Default Description
Int32 200

The column’s width, in pixels.

Remarks

The grid allows you to export data to XLS, XLSX, and CSV formats. When exporting to Excel formats, use the ExportWidth property to specify the column width in pixels in the exported document.

Note that Microsoft Excel performs width calculation in characters. When you open a document, Excel converts the column width in pixels to characters. The column width in characters differs on a machine with more than 100% DPI - the resulting width in pixels differs from the specified value. You can handle the CustomizeColumn action and specify the Column.WidthInCharacters property to set the column width in characters.

The following example applies the ExportWidth property to Contact Name and Contact Title columns:

<DxGrid @ref="Grid" Data="@Data" >
    <Columns>
        <DxGridDataColumn FieldName="ContactName" ExportWidth="300"/>
        <DxGridDataColumn FieldName="ContactTitle" ExportWidth="150"/>
        <DxGridDataColumn FieldName="CompanyName" />
        <DxGridDataColumn FieldName="Country" />
    </Columns>
</DxGrid>

<OptionButton Text="Export to XLSX" OnClick="ExportXlsx_Click" />

@code {
    IEnumerable<object> Data { get; set; }
    IGrid Grid { get; set; }
    protected override async Task OnInitializedAsync() {
        Data = await NwindDataService.GetCustomersAsync();
    }
}

For more information about data export in the Grid component, refer to the following topic: Export Data in Blazor Grid.

Implements

See Also