c# - How to find the paragraph node is within the table node in OpenXML -


i have tried in following code sample ancestor property find paragraph node within table node it's not working cases.

using (wordprocessingdocument docx = wordprocessingdocument.open(docxstream, true)) {     body docxbody = docx.maindocumentpart.document.body;     list<openxmlelement> eachpara = new list<openxmlelement>();//paragraph element     foreach (openxmlelement bodychild in docxbody.childelements)     {         if (bodychild paragraph)         {             if (bodychild.ancestors<table>().tolist().count > 0)             {              }         }     }     //  list<openxmlelement> eachpara = docxbody.childelements.tolist().where(eachchild => eachchild paragraph).tolist();     foreach (openxmlelement lstpara in eachpara)     {         if (lstpara.childelements.any(ch => ch.localname.tolower().equals("run")))         {          }         else         {         }     }  } 


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -