Reputation: 1163
I'm using ruby/nokogiri to parse a word form and fill the fields. I've already managed to fill the text fields but I'm having difficulties to check a checkbox. I've looked on the document.xml and didn't notice any different tags when the checkbox is marked or not
Upvotes: 7
Views: 5912
Reputation: 42622
You need your XML to look like:
<w:ffData>
<w:checkBox>
<w:size w:val="20" />
<w:checked w:val="true" />
</w:checkBox>
</w:ffData>
Observe that w:checked
has the parent w:checkBox
. Documentation on CheckBox class
Alternatively you can set the default state.
Unchecked: <w:default w:val="0"/>
Checked: <w:default w:val="1"/>
<w:ffData>
<w:checkBox>
<w:default w:val="1" />
</w:checkBox>
</w:ffData>
Upvotes: 3
Reputation: 1163
I've found the solution
when a checkbox is checked, there is a tag: <checked />
and when it isn't checked it is: <checked val='0' />
Upvotes: 3