Hi everyone, it's my first question on the forum.
I learnt to use docx4j by myself, for now I didn't have to ask a lot, but now I'm really stuck and I don't know what to do so I ask it here
Ok so my problem is that I have a table already done and full of content controls. Each cell has one content control.
The thing I want to do is : if (content control X has a tag = Y) then {erase the whole row}.
I don't want to use binding, and I'm quite sure it will not help here. I also don't want to use Xpath.
What I was using was :
if (CAliasVal.equals("RULE[\"TauxRestauration\"]")){
Object o2 = ((org.docx4j.wml.SdtPr) pr).getParent();
Object o3 = ((org.docx4j.wml.SdtRun) o2).getParent();
Object oi = XmlUtils.unwrap(o3);
Object o4 = ((org.docx4j.wml.SdtRun) oi).getParent();
Object o5 = XmlUtils.unwrap(o4);
Object o6 = ((org.docx4j.wml.SdtRun) o5).getParent();
Object o7 = XmlUtils.unwrap(o6);
System.err.println(o7.getClass());
}
What I want, is to get the parent of SdtRun so P in my XML, and after what get Tc and finally get Tr to remove the row. But What ever I do, I'm stuck in SdtRun. And If I get its parent I still get SdtRun. What should I do ?
PS : I put ((org.docx4j.wml.SdtRun) o5) every time because I know it's what I get
PSS : I tryed to remove my content control then remove all Tc that were empty to eventually remove all Tr that are empty too but. Removing the content control doesn't make the cell empty
Please help me, there is nothing on the web. Even just a hint will help, I've tryed everything I know, but sadly i'm no expert.