Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loop through xdocument openxml

Status
Not open for further replies.

deejayAr

Technical User
Mar 20, 2008
126
US
<w:p>.....<w:p>
<w:p w:rsidR="00C72E37" w:rsidRDefault="00A27CF8" w:rsidP="00A27CF8">
<w:pPr>
<w:pStyle w:val="Description"/>
</w:pPr>
<w:r w:rsidRPr="00686C21">
<w:rPr>
<w:rStyle w:val="Habit"/>
</w:rPr>
<w:t>Trees, shrubs, lianas or herbaceous vines</w:t>
</w:r>

<w:p w:rsidR="00C72E37" w:rsidRDefault="00A27CF8">
<w:pPr>
<w:ind w:right="19"/>
</w:pPr>
<w:r>
<w:rPr>
.......
</w:rPr>
</w:r>
<w:r w:rsidRPr="00A27CF8">
<w:rPr>
<w:rStyle w:val="Family"/>
</w:rPr>
<w:t>SAPINDACEAE</w:t>
</w:r>
<w:r>
<w:rPr>
......
</w:rPr>
</w:r>
</w:p>
<w:p>.....<w:p>
<w:p>.....<w:p>




I need to loop through every <w:p> of the document
First need to find out it’s child <w :pPr> has child <w:pStyle> that contain w:val and get its value and <w:t>Trees, shrubs, lianas or herbaceous vines</w:t>
Then look at <w:p>’s other <w:r> children and find out if it’s any of child has
<w:rStyle w:val="name"/> and get it’s value and <w:t>SAPINDACEAE</w:t> value

So the result in key value dictionary

Style=” Description” : Text = “ Description”
Style = “Habit” : Text= ” Trees, shrubs, lianas or herbaceous vines”
Style= “Family” : Text = “SAPINDACEAE”

I’m using openxml document xdoument I need to find it's every style and their content from every <w:p>
And their text value
If some you know better way then please help me

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top