Dear all,
I'm trying to apply paragraph styles to various elements in my document, but rather than statically referring to the paragraphs in question (whose position might be subject to change in the future), I'm trying to do it based on a GREP search result. The chapters follow the same structure, with a chapter subheading ('Chapter 1', Chapter 2', and so on), followed by a paragraph with the chapter title, followed by the first paragraph of the body.
Now, it is easy for me to find the chapter subheading using a GREP search, and I would like to know if it is possible for me to read that search result's paragraph number. That way, I can base the paragraph numbers of the remaining elements on their relative position to the subheading, and then apply the appropriate paragraph styles to them.
All the best and thanks in advance,
Julian
p.s.: as a reference, this is the search result:
// Find chapter subheading and apply app.findGrepPreferences = app.changeGrepPreferences = null; app.findGrepPreferences.findWhat = "(?i)Hoofdstuk \w*\r"; var myStartLine = myDocument.findGrep(); // Save search result for future reference as a first line app.changeGrepPreferences.appliedParagraphStyle = myPGS_CS ; myDocument.changeGrep();