Free Support Forum - aspose.com

Unable to set font to Wingdings and insert an checkmark character

WorkSheet.Cells[RowNum, ColNum].PutValue("\u00FC");
columnStyle.Font.Name = “Wingdings”;
columnStyle.Font.Charset = 2;
WorkSheet.Cells.ApplyColumnStyle(ColNum, columnStyle, column.Style.StyleFlag);

This is not working; Instead the font gets defaulted to Arial 10. I’ve also tried Charset 0 and 1. I’m saving as an xlsx.

@jsmith223,

Thanks for your query.

You need to set StyleFlag.FontName = true in order to change font name. Please use the following sample code and provide your feedback.

Workbook wb = new Workbook();
var ws = wb.Worksheets[0];
ws.Cells[0, 0].PutValue("\u00FC");
Aspose.Cells.Style style = wb.CreateStyle();
style.Font.Name = "Wingdings";
style.Font.Charset = 2;
var flag1 = new StyleFlag();
flag1.FontName = true;//NOTE THIS LINE
ws.Cells.ApplyColumnStyle(0, style, flag1);
var fontName = wb.Worksheets[0].Cells.Columns[0].Style.Font.Name;
wb.Save(path + "output.xlsx");

Very good. Thanks Ahsan, setting styleflag.FontName = true resolved the issue.

@jsmith223,

Good to know that your issue is sorted out by the suggested line(s) of code. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.