Click or drag to resize

IWorkbook CreateFont Method

Overload List
Name Description
Public method Code example CreateFont
Method to create a font object and register it in the workbook.
Examples
The following code illustrates how to create IFont object:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>IRichTextString richText = worksheet["B2"].RichText;</para><para>//Create font</para><para>IFont font = workbook.CreateFont();</para><para>//Set color</para><para>font.Color = Color.Red;</para><para>//Set text</para><para>richText.Text = "Sample";</para><para>//Set font</para><para>richText.SetFont(0, 5, font);</para><para>//Save to file</para><para>workbook.SaveToFile("CellFormats.xlsx");</para>
Public method CreateFont(Font)
Method creates a font object based on native font and register it in the workbook.
Public method CreateFont(IFont)
Method that creates font object based on another font object and registers it in the workbook.
Top
See Also