NanoXLSX Library Documentation
![]() | StyleBasicStylesFont Method |
Gets a style with a user defined font
Namespace: NanoXLSX.Style
Assembly: NanoXLSX (in NanoXLSX.dll) Version: 1.2.3.0 (1.2.3)

C#
public static Style Font( string fontName, int fontSize = 11, bool isBold = false, bool isItalic = false )
Parameters
- fontName
- Type: SystemString
Name of the font - fontSize (Optional)
- Type: SystemInt32
Size of the font in points (optional; default 11) - isBold (Optional)
- Type: SystemBoolean
If true, the font will be bold (optional; default false) - isItalic (Optional)
- Type: SystemBoolean
If true, the font will be italic (optional; default false)
Return Value
Type: StyleStyle with font definition

The font name as well as the availability of bold and italic on the font cannot be validated by NanoXLSX. The generated file may be corrupt or rendered with a fall-back font in case of an error
