Thanks for chiming in.
Concerning the anchored images, I think I can wait until the WP Delete is implemented.
I tried your code for cleaning breaks. I just added:
WP INSERT DOCUMENT(WParea;WPareaNew;wk replace)
To replace the content of the original document.
But there are two problems:
- I’m also getting header and footer text as paragraphs in the collection.
- The paragraphs collection is not ordered, the result I’m getting is mixed up.
Eg: create a new document, type text P1, insert section break, type P2, insert page break, type P3. Then go back to page 1 and add a section 1 header (H1) and footer (F1)
When running the code, I get:
But I could solve both by changing the second line of the code to:
$rangeBody:=WP Create range(WParea;wk start text;wk end text)
$collection:=WP Get elements($rangeBody;wk type paragraph)
Is this the right way?
In my testing the paragraphs came in the correct order, but can I be sure this will always be the case?