Specifically, here's something I can't figure out: how to find text, the replace with nothing (delete it).
I'm converting PM tags in imported Word document files. I want to set the paragraph style for the paragraph a tag is found in, then delete the tag, so that:
<A>Heading Level A Text
becomes
Heading Level A Text [with paragraph style A applied]
With this setting the style is applied, but the tag is not stripped, rather left alone (tabs replaced with line endings here):
text
{findWhat:"<A>"}
{changeTo:"", appliedParagraphStyle:"A"}
I tried entering a second line with the third field {changeTo:""} , that is, without attributes, but I got the same result.
I also copied the line and modified it for other tags (to at least get the styles applied), but none of the finds work after the first one. Is there something that needs to be done to set a find to start over (top of the file)?
And what will happen when a find has no results? Does it ignore the change, then move to the next line? I thought that might be what's stopping the script with additional lines, but the second line should have found several instances of the find criteria.
Why don't I convert the PM tags to ID tags in the document first? you may ask. The problem there is I have to save the document as text only in order to import it, so I'd lose any character formatting like italics. I found out Word 2007 will search for formatted text, then insert text (such as an ID characterstyle tag) before and after it, so I can try getting characterstyle tags around formatting, but I'd rather minimize the prep work in Word.