Get/Set character properties of TextPortion
Posted: Wed Mar 29, 2017 2:45 am
I'm trying to write code to search out every space in a Writer document and set it's character properties to be the same as those of the following character.
To this end, I've written code in OpenOffice BASIC that cycles through each TextPortion, checks if the last character is a space, and if so, removes it and then appends a space to the beginning of the next TextPortion. However, any default (i.e., unset) character properties in the "next TextPortion" get changed to those of the preceding text portion.
For example, if I have "a b" where "a " is small caps and "b" is italic, I wind up with "a" being small caps (fine) and " b" being small caps and italic (not fine). What I want is for " b" to be just italic and not pick up the small caps attribute.
To work around this, I would have to change every space in the document by hand, which isn't a reasonable solution for me. How can I do this in code?
Many thanks,
Aaron
To this end, I've written code in OpenOffice BASIC that cycles through each TextPortion, checks if the last character is a space, and if so, removes it and then appends a space to the beginning of the next TextPortion. However, any default (i.e., unset) character properties in the "next TextPortion" get changed to those of the preceding text portion.
For example, if I have "a b" where "a " is small caps and "b" is italic, I wind up with "a" being small caps (fine) and " b" being small caps and italic (not fine). What I want is for " b" to be just italic and not pick up the small caps attribute.
To work around this, I would have to change every space in the document by hand, which isn't a reasonable solution for me. How can I do this in code?
Many thanks,
Aaron