< Previous | Next >

Lesson 1: Create a base template

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.
  1. Open the Document Studio application.
  2. Create a template by clicking File > New > Document template.
  3. Add elements and formatting to your template:
    1. From the Palette view, select a Paragraph element Paragraph element and place it into the template content editor.
    2. Select a Text element Text element and place it inside the paragraph element.
    3. Select the text element you just placed into the template content editor.
    4. In the Properties view, expand formatting > font.
    5. For the bold property, enter true.
      A text element inside a paragraph element.
    6. Select a Table icon Table element and place it after the paragraph element.
    7. In the New table window, enter 1 row and 3 columns. Click OK.
    8. From the Palette view, select the Container icon Container element and place it into the table element.
      A table that has a container element and a row element with three cells.
    9. In the Palette view, click Select icon Select.
    10. Select the row element in the template and drag it into the container element. The table element contains a container element, the container element contains the row element, and the row element contains three cells.
    11. Select the Text element Text element and drag it into each of the three cells. Each cell contains a text element.
  4. Add a name and width to the first cell element:
    1. Select the first cell.
    2. In the Properties view, expand Metadata.
    3. For the name property, enter Cell 1.
    4. Expand formatting > specific.
    5. For the cell width property, enter 50.
  5. Add a name and width to the second, middle cell element:
    1. Select the second cell.
    2. In the Properties view, expand Metadata.
    3. For the name property, enter Cell 2.
    4. Expand formatting > specific.
    5. For the cell width property, enter 50.
  6. Add a name and width to the third cell element:
    1. Select the third cell.
    2. In the Properties view, expand Metadata.
    3. For the name property, enter Cell 3.
    4. Expand formatting > specific.
    5. For the cell width property, enter 150.
  7. Create a variable:
    1. In the Outline view, right-click Variables and click Insert > New Variable.
    2. In the Name field, enter iteration_.
    3. Leave the default selections for the remaining fields and click OK.
  8. Assign the iteration_ variable to the container element:
    1. Select the container element.
    2. In the Properties view, for the Assignments property, click the Configuration icon Configuration icon.
    3. In the Assignments editor window, click Add.
    4. Select the iteration_ variable and click OK.
    5. Click the Script expression tab.
    6. Expand Variables.
    7. Select the iteration_ variable.
    8. 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.
    9. Click OK and OK to close the windows.
  9. Add a script to the container element:
    1. Select the container element.
    2. Expand formatting > specific.
    3. In the do while condition property, click the Configuration icon Configuration icon.
    4. Click the Script expression tab.
    5. Expand Variables.
    6. Select the iteration_ variable.
    7. 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.
    8. Click OK.
  10. Add a script to the Text element in Cell 1:
    1. Select the Text element in Cell 1.
    2. In the Properties view, for the Content property, click the Configuration icon Configuration icon.
    3. Click the Script expression tab.
    4. Expand Variables.
    5. Select the iteration_ variable.
    6. 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.
    7. Click OK.
  11. Add a script to the Text element in Cell 2:
    1. Select the Text element in Cell 2.
    2. In the Properties view, for the Content property, click the Configuration icon Configuration icon.
    3. Click the Script expression tab.
    4. Expand Variables.
    5. Select the iteration_ variable.
    6. 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.
    7. Click OK.
  12. Add a script to the Text element in Cell 3:
    1. Select the Text element in Cell 3:
    2. In the Properties view, for the Content property, click the Configuration icon Configuration icon.
    3. Click the Script expression tab.
    4. Expand Variables.
    5. Select the iteration_ variable.
    6. 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.
    7. Click OK.
  13. Save the template as a base for the remaining tutorial lessons. Click File > Save and select an output name and location. Example: C:\Documents and Settings\Administrator\Desktop\table_sizing_tutorial\table_sizing_tutorial-lesson1_base.dta
Result:
Template screenshot after completing Lesson 1

Lesson checkpoint

You created a template, added elements to the template, created a variable, and wrote scripts for the text elements.
< Previous | Next >

Feedback