"Some of the cell formatting may have changed. Maximum number of fonts exceeded.........."

Hi ,

I am getting this error message:

“Some of the cell formatting may have changed. Maximum number of fonts exceeded…”

whenever I open my reports in excel. It is very strange.

I have not used more than one font : “Arial” and that too size 8. It shows up the excel file fine(with just one font) after poping up that error message.

Will appreciate your quick reply,

Thanks

Hi,

Aspose.Excel currently does not combine the same fonts that you set to different cells.

For example, if you use the following code:


int styleIndex = excel.Styles.Add();
Style style = excel.Styles[styleIndex];
style.Font.Size = 8;

cells[“A1”].Style = style;

styleIndex = excel.Styles.Add();
Style style = excel.Styles[styleIndex];
style.Font.Size = 8;

cells[“A2”].Style = style;

Two font records will be saved in the result file, not just one.

If the style of two cell is the same, you can directly set a style object to two cells. That will decrease the number of fonts and styles.

int styleIndex = excel.Styles.Add();
Style style = excel.Styles[styleIndex];
style.Font.Size = 8;

cells[“A1”].Style = style;
cells[“A2”].Style = style;