We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Setting individual characters to Bold undoes other formatting

I have a block of 7x4 merged cells into which I insert text: 3 sentences separated with hard line returns (’\n’). I have set the worksheet’s default style to Tahoma, font size 9. After inserting the text, I also apply a style whose attributes include Tahoma and font size 9.

If I export and view the results, they are correct. However - I then wish to set the first word of each of the three sentences to be bold using a command of the form: range[0, 0].Characters(x, y).Font.IsBold = true. If I do this, the specified letters all become bold, but then when the sheet is exported, the font is Cambria 10. When I highlight the merged cell, it shows in the Excel toolbar that it is Tahoma 9, but it is not. If I right-click the cell in Excel and select “Format Cells…”, it shows there that the font is actually Cambria (which seems to be an Excel 2007 default), and it does not recognize a size, though it is in fact size 10. I have also tried setting the style attributes again after applying the boldness, to no avail.

What is going on, and how can I have both the style I desire and bold certain words in my text?

Thank you,


Thank you for considering Aspose.

I tested you scenario with the latest version of Aspose.Cells and it works fine. Please download and try the latest version from the following location and if you still face any problem, please share your sample code and generated file and we will check it soon.

Following is my sample code:

Workbook workbook = new Workbook();
Style style = workbook.Styles[workbook.Styles.Add()];
style.Font.Name = "Tahoma";
style.Font.Size = 10;
workbook.DefaultStyle = style;

Worksheet sheet = workbook.Worksheets[0];
sheet.Cells[0, 0].PutValue("Test For Font Setting \n Default Font Tahoma \n Test For New Font");
sheet.Cells[0, 0].Style.IsTextWrapped = true;
sheet.Cells[0, 0].Characters(0, 4).Font.IsBold = true;


Thank You & Best Regards,