converting styledtext to StringShape


I have some styled text in a textarea and wanted to add it to a canvas - I thought I would use the stringshape object to do this. I am extracting each character and then assigning it to a stringshape think that the attributes would be retained but they’re not - something like (I know I have not addressed the spacing yet)

  dim x2 as new StringShape
    dim x3 as StyledText 
    for J=1 to Len(textarea1.text)
    next J    

In the above code X2 does not retain the style of X3 - for instance if it is underlined then this is removed as are any colours, fonts etc…

Where am I going wrong?


When you copy text from a .text property, you’re just copying the string, not the style.

Unfortunately, there’s no way to automatically copy the style from a textArea to a StringShape. You’ll have to do it manually, stepping through the Styleruns and applying those same characteristics (font, size, emphasis) to the StringShape.

Thank you for your reply Marc. Yes I started that way but its around 50-100 words which coukd contain over 20 styleruns or more so was just looking for another way to annotate my charts. C’est la vie. Thanks anyway.