Page 1 of 1

Finding a Checkbox and checking it

PostPosted: Tue Apr 02, 2013 10:44 pm
by Ananasi
Hello Everyone

Im unfortunatly rather new to docx4j and I am trying to figure out how to check a checkbox within a template that I have.
I tried working with Xpaths and get the Node that way but Im not sure I got it right, also even if I manage getting the right Node Im not quite sure how to change the value properly, replacing text I managed to figure out but I havent figured out changing a attribute value yet.

checking the document.xml i found the name of the Checkbox and the attributes it has
Code: Select all
<w:fldChar w:fldCharType="begin">
<w:ffData><w:name w:val="Kontrollkästchen1"/>
<w:enabled/>
<w:calcOnExit w:val="0"/>
<w:checkBox><w:sizeAuto/><w:default w:val="0"/></w:checkBox>


And I tried diffrent premutations of Xpaths, for example:
//ffData[@name='Kontrollkästchen1']/checkBox

Would this find the Node I want? If not, how could I get the node and change the attribute correctly?

Thank you
Magnus

Re: Finding a Checkbox and checking it

PostPosted: Wed Apr 03, 2013 1:39 pm
by jason
Please don't cross post!

Answered at http://stackoverflow.com/questions/1576 ... checkboxes