5.27.21. Write Tables in Docx

<< Click to Display Table of Contents >>

Navigation:  5. Detailed description of the Actions > 5.27. Output Actions >

5.27.21. Write Tables in Docx

 

Icon: writeDocTable-icon

 

Function: writeDocTable

 

Property window:
 

writeDocTable

 

Short description:

 

Inject a data table inside a MS-Word template document with Table-Style support!

 

Long Description:

 

Anatella searches for the different markers and replaces them with the tables given in the input pins.

 

New versions of MS-Word are adding some invisible tags inside the .docx documents. These invisible tags might prevent the “marker substitution process” to work. Please refer to the section 5.27.20.2. for the procedure  to get a “clean” template document (without all these invisible tags).

 

Here is an example:

 
clip0908

 

 

The parameter “column width” has 3 operating modes:
 

Operating mode 1: The “column width” parameter is empty: the width of the injected Table inside the MS-Word document is 100% of the available width.
 

Operating mode 2: you only give one number. This number defines the width of all of the columns inside the Table inside the MS-Word document.
 

Operating mode 3: you give a list of comma-separated numbers. These numbers define the width of each of the columns inside the Table inside the MS-Word document.
 

The length-unit used inside the “column width” parameter is the “% multiplied by 100” (i.e. the “per-ten-thousands”). For example:

 
clip0909

 

The “Table Style” parameter is a combo box that only works after you have defined the “Template” parameter. Once the “Template” parameter is defined, Anatella analyzes it and displays all the “Table Style” available inside the “Template” file: In the example below, the “template3.docx” document contains 3 “table styles”:
 

clip0910

 
The “Normal Table” and “Table Grid” table-styles are (almost) always defined. The “template3.docx” document also contains one additional extra&custom table-style named “MyTIMiStyle”. number1

 
 
Let’s now see how we can define our own table styles! The steps are:
 

1.Create a 1x1 table (inside a floating text box):
 

1.1.Insert a floating “text box” in the margin of the page (in this way you can hide it easily later).
 

Open the “Insert” panel, number2    click on “Shapes”, number3     click on the “Text box” clip0911 icon: number4

 

clip0912
 

 

1.2.Draw your floating text box in the margin of the page:
 

clip0913

 

 

1.3.Insert a 1x1 “table” inside your new floating text box.
 

Click inside your text box.

 
Open the “Insert” panel, number1     click on “Table”, number2    click on the cell that represent the “1x1” table: number3
 

clip0914

 
 

2.Define a new style for your new 1x1 table.
 

2.1.Open the “Table Tools/Design” panel, number1    click on the “More” clip0915 button here: number2
 

clip0916

 

 

2.2.Inside the drop-down-meu, select “New Table Style”:

 

clip0917

 

 

2.3.Define a new Table Style: For example:
 

clip0918

 
 
The above new Style is named “MySuperStyle”, it contains the following settings:
 

oHeader Row: with a “Dark Blue” blackground

oOdd banded Row: with a “Light Blue” blackground

oFirst column: font in Bold

Once finished, click the “OK” button: number1

 

You can define many different styling options for:
 

oThe header row

oThe total (last) row

oThe First column

oThe Last Column

oOdd banded rows

oEven banded rows

oOdd banded columns

oEven banded columns

 
clip0919

 
 
3. Hide the small 1x1 table (i.e. cover it with a white rectangle)

 

3.1. Open the “Insert” panel, number1     click on “Shapes”, number2     click on the “Rectangle” clip0928   icon: number3
 

clip0920

 
 

3.2. Draw your rectangle over the floating text box that contains your table:
 

clip0921

 
 

3.3. Change the background color and the outline color of your new rectangle to white: Right-click your new rectangle and select the white color for the “Fill” and “Outline” option:

 

clip0923

 

 

At the end, you get something like this:

 

clip0922

 
 

4. Save your .docx document: press [CTRL]+[S].

 

5. Let’s use our new style!
 

clip0927

 
We obtain:

 

clip0926