

'DeclarationPublic Class Font Inherits Xceed.Workbooks.NET.StyleBase(Of IReadonlyFont) Implements IReadonlyFont
'UsageDim instance As Font
public class Font : Xceed.Workbooks.NET.StyleBase<IReadonlyFont>, IReadonlyFont
using( var workbook = Workbook.Create( "test.xlsx" ) ) { // Get the first worksheet. A workbook contains at least 1 worksheet. var cellWorksheet = workbook.Worksheets[ 0 ]; // Add a title. cellWorksheet.Cells[ "B1" ].Value = "Set Fonts"; cellWorksheet.Cells[ "B1" ].Style.Font = new Font() { Bold = true, Size = 15.5d }; // Set cell content and Font styles. cellWorksheet.Cells[ "C5" ].Value = "Bold, Italic and Underline"; cellWorksheet.Cells[ "C5" ].Style.Font = new Font() { Bold = true, Italic = true, Underline = true, UnderlineType = UnderlineType.Double }; cellWorksheet.Cells[ "C8" ].Value = "Bold and red Broadway"; cellWorksheet.Cells[ "C8" ].Style.Font.Bold = true; cellWorksheet.Cells[ "C8" ].Style.Font.Color = System.Drawing.Color.Red; cellWorksheet.Cells[ "C8" ].Style.Font.Name = "Broadway"; cellWorksheet.Cells[ "C12" ].Value = "Strikethrough and size 18"; cellWorksheet.Cells[ "C12" ].Style.Font = new Font() { Strikethrough = true, Size = 18d }; cellWorksheet.Cells[ "C15" ].Value = "Superscript"; cellWorksheet.Cells[ "C15" ].Style.Font = new Font() { Superscript = true }; cellWorksheet.Cells[ "D15" ].Value = "Subscript"; cellWorksheet.Cells[ "D15" ].Style.Font = new Font() { Subscript = true }; // Add a second worksheet for rows. var rowWorksheet = workbook.Worksheets.Add( "Rows" ); // Set row content and font. rowWorksheet.Cells[ 5, 3 ].Value = "Setting row font to Elephant and Orange"; rowWorksheet.Cells[ 5, 11 ].Value = "Another content"; rowWorksheet.Rows[ 5 ].Style.Font = new Font() { Name = "Elephant", Color = System.Drawing.Color.Orange }; // Add a third worksheet for column. var columnWorksheet = workbook.Worksheets.Add( "Columns" ); // Set column content and font. columnWorksheet.Cells[ 5, 5 ].Value = "Setting column font to Lucida, Underline and Italic"; columnWorksheet.Cells[ 11, 5 ].Value = "Another content"; columnWorksheet.Columns[ 5 ].Style.Font = new Font() { Name = "Lucida Fax", Italic = true, Underline = true, UnderlineType = UnderlineType.Double }; // Save workbook to disk. workbook.Save(); }
System.Object
Xceed.Workbooks.NET.StyleBase<T>
Xceed.Workbooks.NET.Font
| Name | Description | |
|---|---|---|
![]() | Font Constructor |
| Name | Description | |
|---|---|---|
![]() | Bold | Gets or sets if the Font is in Bold. |
![]() | Color | Gets or sets the Font's Color. |
![]() | Italic | Gets or sets if the Font is in Italic. |
![]() | Name | Gets or sets the Font's name. |
![]() | Size | Gets or sets the Font's size. |
![]() | Strikethrough | Gets or sets if the Font uses Strikethrough. |
![]() | Subscript | Gets or sets if the Font is in Subscript. |
![]() | Superscript | Gets or sets if the Font is in Superscript. |
![]() | ThemeColor | Gets or sets the Font's ThemeColor. |
![]() | Underline | Gets or sets if the Font is underlined. |
![]() | UnderlineType | Gets or sets the UnderlineType. |
| Name | Description | |
|---|---|---|
![]() | Equals | Determines whether the specified System.Object is equal to the current System.Object. |
![]() | GetHashCode | Serves as a hash function for a particular type. |
| Name | Description | |
|---|---|---|
![]() | OnPropertyChanged | (Inherited from Xceed.Workbooks.NET.StyleBase<IReadonlyFont>) |
.NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.
.NET Framework: net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.