Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use an IEnumerable variable to create an Excel worksheet in C# windows form application. The problem is I can set created worksheet font if the font name has 1 word, ex. 'Arial', but I for font name with space it doesn't work, ex. 'B Mitra'. My code is:

C#
var wb = new XLWorkbook { RightToLeft = true };
var ws = wb.Worksheets.Add("SickIn_formation");
ws.Columns().AdjustToContents();
ws.Style.Font.FontName = "B Mitra";


What I have tried:

I have tried using font name without space and with hyphen, but it didn't work
Posted
Updated 26-Dec-19 2:02am

1 solution

According to the documentation the Font object has a Name property, but not a FontName property. Also, make sure the font you are selecting is correctly installed on your system.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900