I am using an IEnumerable
variable to create an Excel worksheet in C# windows form application. The problem is that I can set created worksheet font if the font name has 1 word, ex. 'IRNazanin', but for font name with space it doesn't work, ex. 'B Mitra'. My code is:
var wb = new XLWorkbook { RightToLeft = true };
var ws = wb.Worksheets.Add("Sick_Information");
ws.Columns().AdjustToContents();
ws.Style.Font.FontName = "B Mitra";
I have tried using font name:
- without spase, ex. "BMitra"
- with a hyphen, ex. "B-Mitra"
- with underline, ex. "B_Mitra"
- with extra single qout, ex. "'B Mitra'"
Still not working.
I am using ClosedXML.Excel
library with ClosedXML
version 0.94.2.0
and MS Office 2016. The excel will get the font name but won't apply it.
True B Mitra
font is like this. (Changed manually)
The customer needs file with B Mitra
font and Persian numbers. So I have no choice to change the font.