cell.getCharacters() does not work as expected

hello,

I am using the Java toolchain

I have a RICH_TEXT_STRING cell with 2 fonts: the first few characters are bold and the rest are plain.

I expected to get Characters[] with 2 items, one for each font, however I get only Characters[1] array which parameters (font,start,length) are related to the second portion of the string.

How do i get the missing Characters item?

for the following cell, which has 4 runs I get only array of 2 characters which relates to the words {plan, world} while I was expecting array of 4 runs.

Deliver Plan hello world

Hi,

Yes, we found an issue with getCharacters() method after an initial test, we will figure it out soon.

Thank you.

Hi,

Well, actually it's not a bug rather a limitation for Cell.getCharacters() method, the returned Character[] will only contain format settings for part of the richtext, the absent parts will use the default Font defined for given Cell. For example, for your case i.e.., Deliver Plan hello world it will return Character[] that is related to the words {plan, world}. Moreover, the Font for this Cell should be Bold and the part of {Deliver, hello} just uses this Font of the cell.

Anyways, we will soon provide you a version which will return all the runs for Cell.getCharacters() method for your need.


Thank you.

Hi,

Please try the attached version, we have changed the logic for Cell.getCharacters() method. Now the returned array of Characters should cover the whole text completely, i.e.., the array will contains those Characters that use default font too. For your case, it will return 4 Characters now.

Thank you.

I am now able to get the formatting information for all the portions of the rich text.

Thanks!

Shay

Hi Shay,

As we have updated some other issues regarding the font displays, so we recommend you to ignore the fix attached in my previous post (Aspose.CellsV2.0.0.5) and use this attached fix (Aspose.CellsV2.0.0.6).

Thank you.