'Declaration
Public Class Font Inherits Xceed.Workbooks.NET.StyleBase(Of IReadonlyFont) Implements IReadonlyFont
'Usage
Dim instance As Font
public class Font : Xceed.Workbooks.NET.StyleBase<IReadonlyFont>, IReadonlyFont
'Declaration
Public Class Font Inherits Xceed.Workbooks.NET.StyleBase(Of IReadonlyFont) Implements IReadonlyFont
'Usage
Dim 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
Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2