Word guide Basic

Learn how to create and populate the Word templates from scratch.

Table of contents

Create web page



Our main web page will contain orders that (in terms of the tutorial) include essential information: company name and phone, product name and quantity. The main web page will be called Order and will be of the Directory type kind. And the Product must be a collection field since it may contain multiple rows of data. Furthermore, it should be of the Embedded type kind, so the products collection will be unique for every order (if we used the Directory type, then the product collection will be the same for all the orders).

On the image below, you see the final interface we are going to achieve. Our web page should contain three main parts:

  1. Company information
  2. Product collection
  3. Button to download word doc


Create Order Directory data type

In your Builder, go to the data types page. Click on the Add page button. Specify the type name Order. A new directory type will be created. On the type details page, create the Web page with the name "Order".


Create Product Embedded data type

In your Builder, go to the data types page. Click on the downside arrow on the right side of the Add page button. Select the Embedded from a dropdown list.


Create Product table view

On the Product type details page, click on the Product - table. On the pop-up window, confirm the Create operation (give the name you want, we used the auto-generated one). You will be redirected to the table view editor.
Drag and drop the Text input field into the table view. Name it "Name".
Drag and drop the Number (or Integer - they are the same) field into the table view. Name it "Quantity".


Add fields to the Order web page.

Go to the Orders web page. Split the groupbox. You will get two groupboxes. Rename both of them into Company and Product. Make sure that the Show header option is on.

Change the APPEARANCE if you want:
Drag and drop Text input field into the Company Groupbox. Name it "Name". Drag and drop Phone number field into the Company Groupbox. Name it "Phone".

Define the Product collection

Drag and drop ADD NEW FIELD → Define → Collection field into the Product groupbox.

On the pop-up window, select the Product data type we have created before.


Add "Download word" action



Given method of template generation and downloading is relatively simple one as it uses predefined Server action called Download word doc and works only with the default Word view (therefore, only one template can be used at most).

From the Components, LAYOUT, drag and drop the button. The toolbar seems the right place for it, near the Save and close button. Click on the toolbar to start editing it.

Click on the button to open its properties panel. In GENERAL, change the Button Title ("Download word" in our case).
In the APPEARANCE change the Button appearance (color, icon, size) if you want.
In ACTIONS select the Server action Download Word doc.
The interface is ready. Now let's create readable System names and write a Word template.


Edit System names



Go to the Order type details page. On the FIELDS section, click on the arrow of an existing field and then Edit to change a field System name.

The following System names were used:

  • Company Name: company_name
  • Company Phone: company_phone
  • Product: product
  • Product Name: name
  • Product Quantity: qty
The Product name or quantity can be accessed as {product.name} or {product.qty} from the MS Word template.


Write MS Word template



Create the following .docx file (or use download link). The {product.name} is a collection and the table will expand depending on the number of rows.

Create the Word view on the Order type details page.

Upload the template:
Now, Publish and Open the application and test it!

Related info
Directory
Embedded
System names
MS Word template
Web Page Editor
Table View Editor
Build and Deploy