DocumentExportElementStyle.BorderSides Property
Specifies which borders the element displays.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v25.1.dll
NuGet Package: DevExpress.Blazor
Declaration
public BorderSide BorderSides { get; set; }
Property Value
Type | Description |
---|---|
BorderSide | An enumeration value. |
Available values:
Name | Description |
---|---|
None | No borders are applied to a brick. |
Left | Applies the left border to a brick. |
Top | Applies the top border to a brick. |
Right | Applies the right border to a brick. |
Bottom | Applies the bottom border to a brick. |
All | Applies all borders to a brick. |
Remarks
The PDF export engine applies different formatting to document elements for visual clarity. For instance, it applies the bold font attribute to column captions and colors them gray. The image below displays standard document formatting:
You can use PDF export options to customize document appearance. Style options are applied in the following order:
Style settings that you assign to the DefaultElementStyle property in the
CustomizeDocument
event handler. These settings affect all elements: table cells, document/page headers and footers.The export engine’s style settings.
Style settings that you assign to the DataCellStyle property in the
CustomizeColumn
event handler. These settings affect all data cells in the corresponding column.Style settings that you assign to the ElementStyle property in the following event handlers:
CustomizeCell
CustomizeDocumentFooter
CustomizeDocumentHeader
CustomizePageFooter
CustomizePageHeader
These settings affect only the corresponding elements.
Note
Styles applied later have higher priority. For instance, export engine styles override DefaultElementStyle settings.
Specify the following properties to customize an element’s borders: BorderColor, BorderDashStyle, BorderSides
, BorderWidth.
Grid Example
The following example customizes exported document appearance:
@rendermode InteractiveServer
@using DevExpress.Drawing;
@inject WeatherForecastService ForecastService
<DxGrid @ref="Grid" Data="@forecasts">
<Columns>
<DxGridDataColumn Caption="Date" FieldName="Date" />
<DxGridDataColumn Caption="Temperature (C)" FieldName="TemperatureC" />
<DxGridDataColumn Caption="Temperature (F)" FieldName="TemperatureF" />
<DxGridDataColumn Caption="Summary" FieldName="Summary" />
</Columns>
<ToolbarTemplate>
<DxToolbar>
<DxToolbarItem Text="Export to PDF" Click="ExportPdf_Click" BeginGroup="true" />
</DxToolbar>
</ToolbarTemplate>
</DxGrid>
@code {
IGrid Grid;
private WeatherForecast[]? forecasts;
protected override async Task OnInitializedAsync() {
forecasts = await ForecastService.GetForecastAsync(DateOnly.FromDateTime(DateTime.Now));
}
async Task ExportPdf_Click() {
await Grid.ExportToPdfAsync("ExportResult", new GridPdfExportOptions() {
CustomizeCell = OnCustomizeCell, // Customizes table cell appearance
CustomizeDocument = OnCustomizeDocument, // Customizes overall document appearance
CustomizeDocumentHeader = OnCustomizeDocumentHeader, // Adds and customizes a document header
});
}
void OnCustomizeDocument(GridDocumentExportCustomizeDocumentEventArgs args) {
// Sets default font settings for all elements
args.DefaultElementStyle.Font = new DXFont("Times New Roman", 14, DXFontStyle.Regular);
}
void OnCustomizeCell(GridDocumentExportCustomizeCellEventArgs args) {
// Sets border settings for all table cells
args.ElementStyle.BorderColor = System.Drawing.Color.MediumBlue;
args.ElementStyle.BorderWidth = 3;
args.ElementStyle.BorderDashStyle = DevExpress.XtraPrinting.BorderDashStyle.Dash;
// Sets style settings for header cells
if(args.AreaType == DocumentExportAreaType.Header) {
args.ElementStyle.BackColor = System.Drawing.Color.DimGray;
args.ElementStyle.BorderSides = DevExpress.XtraPrinting.BorderSide.None;
args.ElementStyle.ForeColor = System.Drawing.Color.White;
}
args.Handled = true;
}
void OnCustomizeDocumentHeader(GridDocumentExportCustomizeDocumentHeaderFooterEventArgs args) {
// Adds a document header
args.Text = "Weather Forecast";
// Sets header style settings
args.ElementStyle.Font = new DXFont("Arial", 16, DXFontStyle.Bold);
args.ElementStyle.Padding = new DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0);
args.ElementStyle.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
}
}
TreeList Example
The following example customizes exported document appearance:
@rendermode InteractiveServer
@using DevExpress.Drawing
@inject SpaceObjectDataProvider SpaceObjectDataProvider
<DxTreeList @ref="TreeList" Data="TreeListData" ChildrenFieldName="Satellites">
<Columns>
<DxTreeListDataColumn FieldName="Name" />
<DxTreeListDataColumn FieldName="TypeOfObject" Caption="Type" />
<DxTreeListDataColumn FieldName="Mass10pow21kg" Caption="Mass, kg" DisplayFormat="N2" />
<DxTreeListDataColumn FieldName="MeanRadiusInKM" Caption="Radius, km" DisplayFormat="N2"/>
</Columns>
<ToolbarTemplate>
<DxToolbar>
<DxToolbarItem Text="Export to PDF" Click="ExportPdf_Click" BeginGroup="true" />
</DxToolbar>
</ToolbarTemplate>
</DxTreeList>
@code {
ITreeList TreeList { get; set; }
object TreeListData { get; set; }
protected override async Task OnInitializedAsync() {
TreeListData = SpaceObjectDataProvider.GenerateData();
}
async Task ExportPdf_Click() {
await TreeList.ExportToPdfAsync("ExportResult", new TreeListPdfExportOptions() {
CustomizeCell = OnCustomizeCell, // Customizes table cell appearance
CustomizeDocument = OnCustomizeDocument, // Customizes overall document appearance
CustomizeDocumentHeader = OnCustomizeDocumentHeader, // Adds and customizes a document header
});
}
void OnCustomizeDocument(TreeListDocumentExportCustomizeDocumentEventArgs args) {
// Sets default font settings for all elements
args.DefaultElementStyle.Font = new DXFont("Times New Roman", 14, DXFontStyle.Regular);
}
void OnCustomizeCell(TreeListDocumentExportCustomizeCellEventArgs args) {
// Sets border settings for all table cells
args.ElementStyle.BorderColor = System.Drawing.Color.MediumBlue;
args.ElementStyle.BorderWidth = 3;
args.ElementStyle.BorderDashStyle = DevExpress.XtraPrinting.BorderDashStyle.Dash;
// Sets style settings for header cells
if (args.AreaType == DocumentExportAreaType.Header) {
args.ElementStyle.BackColor = System.Drawing.Color.DimGray;
args.ElementStyle.BorderSides = DevExpress.XtraPrinting.BorderSide.None;
args.ElementStyle.ForeColor = System.Drawing.Color.White;
}
args.Handled = true;
}
void OnCustomizeDocumentHeader(TreeListDocumentExportCustomizeDocumentHeaderFooterEventArgs args) {
// Adds a document header
args.Text = "Space Objects";
// Sets header style settings
args.ElementStyle.Font = new DXFont("Arial", 16, DXFontStyle.Bold);
args.ElementStyle.Padding = new DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0);
args.ElementStyle.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
}
}