Frequently asked questions - Writer

From The Document Foundation Wiki
< Faq‎ | Writer
Jump to: navigation, search

How do I insert a variable to enter information in the document?

Variables are managed by fields

  • select the Insert ▸ Fields ▸ Other menu (or Ctrl + F2);
  • select the Variables tab.

To be able to use a variable, the variable must have an existence at the insertion point. In other words, the definition of the variable must precede its use, and therefore be placed "before" in the text, if it is empty. A variable can have multiple values ​​along the document.

To:

  • Define a variable:
    • select the field type Set variable;
    • fill the name and the value at the bottom of the dialog box;
    • select the format. To display a character string, select Text;
    • click Insert then Close.
    • it is possible to place this field at the beginning of the document and then check Invisible; afterwards you can use this variable anywhere in the text.
    • resetting a variable allows its value to be modified.
  • Create an input field to modify the value of this variable later in the text;
    • select the field type Input field;
    • select the variable you want;
    • add an annotation that will give information to fill the field;
    • click Insert;
    • fill in a default value and click OK, then Close.
    • This will insert a field. When it is clicked, its value is prompted for. It will be changed in all uses of the variable downstream of the input field, but not for positions upstream.
  • Use this variable again later in the document :
    • select the field type Show variable;
    • select the field you want to use;
    • click the Insert button then Close.
    • the value shown is the value previously set in the text.
  • Delete a variable:
    • delete all the setting and input fields for the variable in the text using the [Del] key;
    • open the variable dialog box (Insert ▸ Fields ▸ Other ▸ Variables [tab] menu)
    • select the field type Set variable;
    • select the variable you want to delete;
    • click the red cross. If the red cross is not available, that means that some settings or input fields for the variable are still present in the text.

There exists a particular type of variable : the user field, described in this question.