How to get the Paragraph style from w:sdtContent in word XML -
i need style of paragraph have assigned tag value ( contentcontrol ). have added contentcontrol (ie) tag value paragraph in word,i can able text of corresponding paragraph have assigned tag value,
case "documentformat.openxml.wordprocessing.sdtblock": sdtblock p1 = (sdtblock)docelement; string content1 = p1.innertext; if (!string.isnullorempty(content1)) dt.rows.add(content1); break;
and adding para table , need style of para ,when saved word document in xml format these codes
<w:sdtcontent> <w:p w:rsidr="00d57d79" w:rsidrdefault="00176023"> <w:ppr> <w:pstyle w:val="heading1"/> <w:rpr> <w:rfonts w:eastasia="times new roman"/> <w:shd w:val="clear" w:color="auto" w:fill="auto"/> <w:lang w:val="en-us"/> </w:rpr> </w:ppr> <w:r> <w:rpr> <w:rfonts w:eastasia="times new roman"/> <w:shd w:val="clear" w:color="auto" w:fill="auto"/> <w:lang w:val="en-us"/> </w:rpr> <w:t>use case model</w:t> </w:r> </w:p> </w:sdtcontent> </w:sdt>
i need corresponding style of paragraph.how styles?
case "documentformat.openxml.wordprocessing.sdtblock": sdtblock p1 = (sdtblock)docelement; content1 = p1.innertext; ienumerable<paragraph> pp = p1.descendants<paragraph>(); foreach (paragraph para in pp) { style= getparagraphstyleid(para); }
where getparagraphstyleid(para) has
public string getparagraphstyleid(paragraph p) { string parastyleidvalue = string.empty; if (p.paragraphproperties != null) { if (p.paragraphproperties.paragraphstyleid != null) { if (p.paragraphproperties.paragraphstyleid.val != null) { parastyleidvalue = p.paragraphproperties.paragraphstyleid.val.value; } } } return parastyleidvalue; } using style of paragraph sdtcontent.
Comments
Post a Comment