loop through xdocument openxml
loop through xdocument openxml
(OP)
<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
<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