Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
255
FormattedString.GetFont must be called in order (bug or badly documented)
posted

This just took me a while to work out: 

If you  want to format several selected parts of text in a cell, you have to call FormattedString.GetFont(startIndex, length) in incrementing order of /startIndex/. If you don't, the length property might be ignored and the font format might get applied to the remainder of the string, starting at startIndex. 

So never call GetFont(startIndex, length) with an startIndex that is smaller than a startIndex used in a previous call on the same cell/FormatedString.

I don't think this behaviour is documented and think it's a bug really.

Ben