Skip to main content

GridExportCustomizeCellEventArgs.Hyperlink Property

Specifies the processed cell’s hyperlink.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public string Hyperlink { get; set; }

Property Value

Type Description
String

The processed cell’s hyperlink.

Remarks

The CustomizeCell action allows you to customize a cell in the exported file. Use the Hyperlink property to add a hyperlink in the processed cell.

Set the Handled property to true to apply the changes made in the action handler to the cell.

The following code snippet adds hyperlinks to the exported grid cell values.

<DxGrid @ref="Grid" Data="@Data" PagerVisible="false" >
    <Columns>
        <DxGridDataColumn FieldName=@nameof(TestModel.Name) Width="280" >
            <CellDisplayTemplate>
                @context.Value
            </CellDisplayTemplate>
        </DxGridDataColumn>
        <DxGridDataColumn FieldName=@nameof(TestModel.Universal) Width="100" />
        <DxGridDataColumn FieldName=@nameof(TestModel.DXperience) Width="100" />
        <DxGridDataColumn FieldName=@nameof(TestModel.WinForms) Width="100" />
        <DxGridDataColumn FieldName=@nameof(TestModel.WPF) Width="100" />
        <DxGridDataColumn FieldName=@nameof(TestModel.ASP) Caption= "ASP.NET and Blazor" Width="100" />
        <DxGridDataColumn FieldName=@nameof(TestModel.DevExtreme) Caption="DevExtreme Complete" Width="100" />
    </Columns>
    <DataColumnCellDisplayTemplate>
        @if((bool)context.Value == true) {
            <span class="grid-icon grid-icon-check"></span>
        }
    </DataColumnCellDisplayTemplate>
</DxGrid>
<DxButton Text="Export to XLSX" Click="ExportXlsx_Click" />

@code {
    object? Data { get; set; }
    IGrid Grid { get; set; }

    protected override async Task OnInitializedAsync() {
        Data = await _testModelService.GetDataSourceAsync();
    }
    async Task ExportXlsx_Click() {
        var options = new GridXlExportOptions();
        options.CustomizeCell = (e) => {
            if (e.AreaType == DevExpress.Export.SheetAreaType.DataArea && e.ColumnFieldName == "Name") {
                var product = e.DataItem as TestModel;
                e.Hyperlink = product.Url;
                e.Handled = true;
            }
        };
        await Grid.ExportToXlsxAsync("ExportResult", options);
    }
}

Grid - Hyperlinks in exported file

See Also