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

Free Support Forum - aspose.com

Cell text custom color lost after some changing over the cell (XLS) (2209)


I am writing to you about a problem I encountered in working with MSO Excel documents using the Aspose Cells library. Specifically, when we load an Excel document whose format type is “xls”, which has colored text in one of the cells, and then make ANY CHANGE over that same cell, it appears that its color returns to the default (black) color.

Such a behavior is not present if the change is not made over a specific cell. Also, such a problem does not exist over an Excel document whose format type is “xlsx”.

I am enclosing the zip file with source code, as well as the source and target Excel files.

In the hope that together we will quickly overcome the problem!
Best regards!


Source code and XLS files.zip (26.0 KB)


Please notice, I am able to reproduce the issue as you mentioned. I found by simply changing the cell’s style to not bold causes its color lost. I tried different variations in code but to no avail. I have logged a ticket with an id “CELLSJAVA-43310” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

Please try the latest version 20.10.

The font color is not in the color pallete.
1: Use similiar color.

XlsSaveOptions saveOptions = new XlsSaveOptions();
excelWBChanged.save("book1.xls", saveOptions);

2: Replace the color in the pallete with the following codes:

excelWBChanged.changePalette(B2_fontSetting.getFont().getColor(), 0);

Let us know your feedback.

First of all, thank you for your efforts in solving the problem.

I can confirm that the mentioned problem is not reproduced by following your instructions (using version 20.10.0 and implementing the first and second steps from the message).

However, this solves the problem only partially, because although there is no loss of color, there is a loss of trace of the same.
When you click on the subject field (B2) and then on the icon Font Color option - More Colors (Home tab -> Font group) there is no color data (the values are the default black color).
On the other hand, since the Format Cells option is entered for the subject field (B2) and the Font tab is selected, the corresponding values can be seen for the color value.
I am enclosing the screenshots about the above.

In addition to the above, I would ask you, if you could, to introduce me in how the Workbook.changePalette(Color color, int index) method works and what exactly its “index” parameter represents.

Best regards!

FontColor_1.PNG (13.5 KB)
FontColor_2.PNG (23.0 KB)

We have observed the issue as mentioned by you and recorded in our database for further analysis. We will write back here to share our feedback soon.

1: The values are the default black color. Please format characters as codes in MS Excel, then save and close the file. If you open the saved files in MS Excel, you will get the same result.

2: Workbook.changePalette(Color color, int index)
There is a color pool which contains 56 colors in .xls file for Excel 97-2003.
All color of the fonts are stored with color index which refers to the color in the palette.
If the color is not in the palette, MS Excel will find a similar color (SaveOptions.setMatchColor(true) in Aspose.Cells) or replace the color (Workbook.changePalette() in Aspose.Cells).


Thanks for your reply. We stay in touch…