tickCheckboxes

tickCheckboxes

BASIC / ADVANCED / PREMIUM

Ticks or unticks a checkbox in a Word document.

Description
public void tickCheckboxes(HashMap<String, Integer> variables)

This method allows to modify the state of a checkbox in a Word template. It accepts:

  • legacy checkboxes.
  • Word 2010 checkboxes.

You should tag those checboxes so they are recognized by Javadocx as follows:

  • Legacy checkboxes:
    • Go to the developers ribbon tab.
    • Select the checkbox you want to tag.
    • Click in the "Properties" option in the "Controls" menu entry.
    • A pop up window will open.
    • Click on "Add Help Text ..." button.
    • Activate in the "Status bar" tab the "type your own" option.
    • Write the variable name surrounded by the template symbol of your choice ($ by default).
  • Word 2010 checkboxes:
    • Go to the developers ribbon tab.
    • Select the checkbox you want to tag.
    • Click in the "Properties" option in the "Controls" menu entry.
    • A pop up window will open.
    • Write the variable name in the "Tag" input text box surrounded by the template symbol of your choice ($ by default).

Word 2010 checkboxes are not correctly visualized in Word 2007 so use them only in case that you are sure that your final users will use Word 2010 or higher.

Parameters

variable

A HashMap with the names of the variables as keys and values 0 or 1 (ticked or unticked respectively).

Code samples

Example #1

The resulting Word document looks like: