Start by creating a base template in Document Studio and
adding a table element.
In this lesson, you create a template that you can copy and
use in the subsequent lessons. Your template includes a table that
has scripts assigned to add text to certain cells. In the other lessons,
you change the properties for the table and generate output previews
to see how the changes affect the layout.
- Open the Document Studio application.
- Create a template by clicking .
- Add elements and formatting to your template:
- From the Palette view, select a
Paragraph element and place it
into the template content editor.
- Select a
Text element and place it inside the
paragraph element.
- Select the text element you just placed into the template
content editor.
- In the Properties view, expand .
- For the bold property, enter true.
- Select a
Table element and place it after the
paragraph element.
- In the New table window, enter 1 row
and 3 columns. Click OK.
- From the Palette view, select the
Container element and place it into
the table element.
- In the Palette view, click
Select.
- Select the row element in the template and drag it into
the container element.

- Select the
Text element and drag it into each
of the three cells. 
- Add a name and width to the first cell element:
- Select the first cell.
- In the Properties view, expand Metadata.
- For the name property, enter Cell
1.
- Expand .
- For the cell width property,
enter 50.
- Add a name and width to the second, middle cell element:
- Select the second cell.
- In the Properties view, expand Metadata.
- For the name property, enter Cell
2.
- Expand .
- For the cell width property,
enter 50.
- Add a name and width to the third cell element:
- Select the third cell.
- In the Properties view, expand Metadata.
- For the name property, enter Cell
3.
- Expand .
- For the cell width property,
enter 150.
- Create a variable:
- In the Outline view, right-click Variables and
click .
- In the Name field, enter iteration_.
- Leave the default selections for the remaining fields
and click OK.
- Assign the iteration_ variable to
the container element:
- Select the container element.
- In the Properties view, for the Assignments property,
click the
Configuration icon.
- In the Assignments editor window,
click Add.
- Select the iteration_ variable
and click OK.
- Click the Script expression tab.
- Expand Variables.
- Select the iteration_ variable.
- Copy and paste the following script
into the script editor:
iteration_*1 + 1
Even though there is only one row displayed in the template,
this script adds a row for each variable.
- Click OK and OK to
close the windows.
- Add a script to the container element:
- Select the container element.
- Expand .
- In the do while condition property,
click the
Configuration icon.
- Click the Script expression tab.
- Expand Variables.
- Select the iteration_ variable.
- Copy and paste the following script
into the script editor:
iteration_*1 < 4
Even though there is only one row displayed in the template,
this script creates four rows in the output.
- Click OK.
- Add a script to the Text element in Cell 1:
- Select the Text element in Cell 1.
- In the Properties view, for the Content property,
click the
Configuration icon.
- Click the Script expression tab.
- Expand Variables.
- Select the iteration_ variable.
- Copy and paste the following script
into the script editor:
if ( iteration_* 1 == 1)
{
"Lorem ipsum dolor sit amet"
}
else
{
"short text"
}
This script enters the Greek text in the
first row and enters short text in all subsequent
rows.
- Click OK.
- Add a script to the Text element in Cell 2:
- Select the Text element in Cell 2.
- In the Properties view, for the Content property,
click the
Configuration icon.
- Click the Script expression tab.
- Expand Variables.
- Select the iteration_ variable.
- Copy and paste the following script
into the script editor:
if ( iteration_* 1 == 1)
{
"consectetur adipiscing elit."
}
else
{
"short text"
}
This script enters the Greek text in the
first row and enters short text in all subsequent
rows.
- Click OK.
- Add a script to the Text element in Cell 3:
- Select the Text element in Cell 3:
- In the Properties view, for the Content property,
click the
Configuration icon.
- Click the Script expression tab.
- Expand Variables.
- Select the iteration_ variable.
- Copy and paste the following script
into the script editor:
if ( iteration_* 1 == 1)
{
"Aliquam et arcu ut dolor dapibus dapibus ac non urna. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ornare sollicitudin semper. Suspendisse accumsan accumsan nisi, et posuere ante rhoncus sit amet. Ut hendrerit, purus ut ullamcorper accumsan, orci eros accumsan lorem, ut fringilla nisi orci et nisi. Maecenas nec leo at nunc aliquam mattis. "
}
else
{
"short text"
}
This script enters the Greek text in the
first row and enters short text in all subsequent
rows.
- Click OK.
- Save the template as a base for the remaining tutorial
lessons. Click and select an output name and location. Example: C:\Documents
and Settings\Administrator\Desktop\table_sizing_tutorial\table_sizing_tutorial-lesson1_base.dta