How to prepare a Docxpresso template

The main purpose of Docxpresso is to convert a text document into an interactive interface that allows for the gathering of data from end users and collaborators.

In order to do so we need to do some little prior work on our standard Office interface.

If we want to transform parts of our document into interactive areas that can be edited online we must introduce some “placeholder variables” that will be identified and processed by the Docxpresso package.

Text tagging

Docxpresso will recognize any text inserted between double curly brackets: {{example}} as a “variable” that may be edited by the end users.

At this point you should not worry if that “variable” will represent plain text, rich multiline text, a date, a set of closed options or any other data type. That part is delegated to the Docxpresso template processing interface.

IMPORTANT: only use standard chars (letters and numbers dashes and underscores) with no white spaces in your variable names, otherwise you may encounter problems when rendering the templates in a browser.

Image tagging

You may also let end users to edit images simply by including an “Alt text” in the Office interface. The way to do so may depend on the Office suite you are using and even on its version.

By including an alternative text like {{image}} we instruct Docxpresso to turn the image as editable or just as a placeholder for an end user signature.

Clonable blocks

Not all documents have a completely fixed structure and many of them may require that parts of it are cloned or hidden depending on user input.

The most standard case is given by a table with an a priori undetermined number of rows depending on user input. Imagine, for example, an invoice that may include different number of items but, of course, other use cases are also possible.

Tables

All rows or set of rows that include variables are, in principle, clonable.

Although more complicated scenarios are also possible a plain table with variables like the following:

	Item	Price	   
	{{item}}	{{price}}	 
	

Will be interpreted by Docxpresso like a table with a clonable row so the final end user will be able to introduce as many items as needed.

Bookmarks

Bookmarked sections of a document with variables inside will also be interpreted by Docxpresso as clonable/hideable sections of the document that may be replicated by the end user.

Special variable tagging

You may also include what we call “special variables” that are enclosed by double square brackets: [[special]].

This variables will not be directly edited by the end user but rather its value will be determined by the values of other variables introduced in the template. The corresponding formula is also delegated to the Docxpresso processing interface.