Formatting Fonts
Output: FormattingFonts.xlsx
public void Run()
{
var workbook = new Workbook();
var worksheet = workbook.Worksheets[0];
worksheet.Columns[0].WidthCharacters = 11;
worksheet.Columns[1].WidthCharacters = 25;
worksheet["A1"].Value = "Font Name:";
worksheet["B1"].Value = "12 points";
worksheet["B1"].Font.Size = 12;
worksheet["A2"].Value = "Font Name:";
worksheet["B2"].Value = "Arial";
worksheet["B2"].Font.Name = "Arial";
worksheet["B3"].Value = "Bold";
worksheet["B3"].Font.Bold = true;
worksheet["B4"].Value = "Italic";
worksheet["B4"].Font.Italic = true;
worksheet["B5"].Value = "Strikethrough";
worksheet["B5"].Font.Strikethrough = true;
worksheet["B6"].Value = "Subscript";
worksheet["B6"].Font.Subscript = true;
worksheet["B7"].Value = "Superscript";
worksheet["B7"].Font.Superscript = true;
worksheet["B8"].Value = "UnderLine Single";
worksheet["B8"].Font.Underline = SpreadsheetUnderline.Single;
worksheet["B9"].Value = "UnderLine Double Accounting";
worksheet["B9"].Font.Underline = SpreadsheetUnderline.DoubleAccounting;
worksheet["A10"].Value = "Font Color:";
worksheet["B10"].Value = "Red";
worksheet["B10"].Font.Color = SpreadsheetColor.Red;
var paragraph = new RichTextParagraph();
paragraph.Runs.Add(new RichTextRun("12 points ") { FontSize = 12 });
paragraph.Runs.Add(new RichTextRun("Arial ") { FontName = "Arial"});
paragraph.Runs.Add(new RichTextRun("bold ") { Bold = true});
paragraph.Runs.Add(new RichTextRun("red") { Foreground = SpreadsheetColor.Red });
worksheet["B11"].RichText = paragraph;
workbook.SaveAs("FormattingFonts.xlsx");
}