Get/Set character properties of TextPortion

Creating a macro - Writing a Script - Using the API

Get/Set character properties of TextPortion

Postby pnm_asst_ed » 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
AOO413m1(Build:9783) - Rev. 1761381
MacOS 10.12.3 (16D32)

Assistant Editor
Perspectives of New Music
pnm_asst_ed
 
Posts: 9
Joined: Sun Jul 17, 2011 9:09 pm

Re: Get/Set character properties of TextPortion

Postby pnm_asst_ed » Wed Mar 29, 2017 3:13 am

I'm using:

AOO413m1(Build:9783) - Rev. 1761381
MacOS 10.12.3 (16D32)
AOO413m1(Build:9783) - Rev. 1761381
MacOS 10.12.3 (16D32)

Assistant Editor
Perspectives of New Music
pnm_asst_ed
 
Posts: 9
Joined: Sun Jul 17, 2011 9:09 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 7 guests