headley
05-18-2010, 11:54 AM
Sorry for long post, but I want to make sure I explain the problem properly.
In a document I need to find each sentence which contains a particular word and cross-reference it to the outline number it appears under. I can easily find the word and expand to get the sentence, but storing the corresponding outline reference is proving tricky. It’s OK if the search word appears in the header for each outlined section, but when it appears in the body text I can’t find a way to reference it. An example follows of what I’d like to do (please forgive shoddy references to outlines and sections – I hope the example makes it clear):
1 This is the header for section 1 (i.e. outlined)
This is a paragraph in section 1. This sentence contains the STRING I need to find. So I need to pull out the last sentence and then I need to tag it with it's relevant section number - in this case "1".
2 This is the header for section 2
Ditto above. This para is clearly part of document section 2 and I need to find this sentence (because it's got STRING in it) and tag it with "2"
2.1 This is the header for Outline 2.1
This para is clearly part of section 2.1. This sentence contains the STRING so I need to extract it and tag it with "2.1"
2.2 This is the header for section 2.2
I can easily find the sentences which contain STRING in these paragraphs, but I can't find any way to extract the section (outline) reference. I’ve tried using .listformat.liststring property, but this only works if the STRING is in the actual header text. If the STRING is in a normal paragraph below the header (like this one is) then the .listformat.liststring returns nothing
Thanks in advance for any help.
HG.
In a document I need to find each sentence which contains a particular word and cross-reference it to the outline number it appears under. I can easily find the word and expand to get the sentence, but storing the corresponding outline reference is proving tricky. It’s OK if the search word appears in the header for each outlined section, but when it appears in the body text I can’t find a way to reference it. An example follows of what I’d like to do (please forgive shoddy references to outlines and sections – I hope the example makes it clear):
1 This is the header for section 1 (i.e. outlined)
This is a paragraph in section 1. This sentence contains the STRING I need to find. So I need to pull out the last sentence and then I need to tag it with it's relevant section number - in this case "1".
2 This is the header for section 2
Ditto above. This para is clearly part of document section 2 and I need to find this sentence (because it's got STRING in it) and tag it with "2"
2.1 This is the header for Outline 2.1
This para is clearly part of section 2.1. This sentence contains the STRING so I need to extract it and tag it with "2.1"
2.2 This is the header for section 2.2
I can easily find the sentences which contain STRING in these paragraphs, but I can't find any way to extract the section (outline) reference. I’ve tried using .listformat.liststring property, but this only works if the STRING is in the actual header text. If the STRING is in a normal paragraph below the header (like this one is) then the .listformat.liststring returns nothing
Thanks in advance for any help.
HG.