Back to Devexpress

ChartObject.Font Property

officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-chartobject-594ef226.md

latest2.4 KB
Original Source

ChartObject.Font Property

Allows you to change the text font for all chart elements.

Namespace : DevExpress.Spreadsheet.Charts

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
ShapeTextFont Font { get; }
vb
ReadOnly Property Font As ShapeTextFont

Property Value

TypeDescription
ShapeTextFont

A ShapeTextFont object containing font settings.

|

Remarks

The following code changes all fonts used in the chart to Segoe Script, Bold, Navy.

View Example

csharp
Worksheet worksheet = workbook.Worksheets["chartTask3"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet["B2:D4"]);
chart.TopLeftCell = worksheet.Cells["H2"];
chart.BottomRightCell = worksheet.Cells["N14"];

// Set the chart font.
chart.Font.Name = "Segoe Script";
chart.Font.Bold = true;
chart.Font.Color = Color.Navy;
vb
Dim worksheet As Worksheet = workbook.Worksheets("chartTask3")
workbook.Worksheets.ActiveWorksheet = worksheet

' Create a chart and specify its location.
Dim chart As Chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet("B2:D4"))
chart.TopLeftCell = worksheet.Cells("H2")
chart.BottomRightCell = worksheet.Cells("N14")

' Set the chart font.
chart.Font.Name = "Segoe Script"
chart.Font.Bold = True
chart.Font.Color = Color.Navy

See Also

ChartObject Interface

ChartObject Members

DevExpress.Spreadsheet.Charts Namespace