I am trying to read in an Excel cell, including formatting that is character specific within the cell, using Aspose Cells, and am not having success.
My preferred method, and the method I anticipated using, was to simply access the .HtmlString property of the cell. The formatting I need is reasonably basic - bold, italics, underlining, tabs, colors, carriage returns, but I do need them on a character by character basis (i.e. rich-text, not just whole-cell formats), and the HtmlString property does not seem to do this type of formatting at all. My company recently purchased the tool, assuming based on the presence of this property that basic characteristics such as these would be covered, and it is very disappointing and poses a large issue / bug for us that they are not.
In the absence of this functionality, I also tried to do the tedious parsing process myself, and found that even the API for character by character manipulation does not seem to work for reading in cells. I can read the text in fine, but when I try to look at cell.Character(0,1).Font.IsItalic and similar properties, I get false even though the first character in the cell in Excel is in Italic font. Wondering whether I'm doing something wrong or I've hit a bug?
I'm running this code (after registering license, opening workbook, worksheet, etc.):
Cell c = worksheetIn.Cells[j + 1, i];
string a = c.Value.ToString();
bool isItalic = c.Characters(0, 1).Font.IsItalic;
String a ends up with the correct text value of the cell I'm trying to read.
But isItalic ends up false, even though the following is the text as it appears in the cell in the Excel 2003 document:
Put in a formatted |
Likewise, Bolding and other formatting are not detected.
Am I missing something, or if not, then is it possible for you to fix these issues?
Many Thanks!