The SystemWeaver Script Language provides text style and paragraph style options for formatting text in output.  You can define your own or use predefined styles. These same options along with additional ones are available for formatting tables in your reports and documents. This article describes the available formatting options for tables. 


Font and Paragraph Styles

You can apply font styles and/or paragraph styles to the content of your table. Font styles control style, size, color, and font. Paragraph styles cover paragraph alignment and space before and/or after the text. See SystemWeaver Script Language Text and Paragraph Styles for more information. 


Example Configuration

In the below example, the Name is colored red, the Last Changed By and Last Changed is in italics and. Last Changed is right-aligned.

<Report>
     <ParaStyles>
    <ParaStyle name="right" alignment="right"/>
    </ParaStyles>
    <FontStyles>
        <FontStyle name="name" color="red"/>
        <FontStyle name="italic" style="italic"/>
    </FontStyles>

  ...

    <Section title="Updated items">
      <Table>
        <Columns>
          <ItemNameColumn width="150" font="name"/>
          <ItemTypeColumn width="100"/>
          <TextColumn width="100" caption="Changed By" font="italic">#{?LastChangedBy.RealName}</TextColumn>
          <ItemLastChangedColumn caption="Changed" format="yyyy-mm-dd" width="100" font="italic" para="right"/>
        </Columns>
        <ForEachItemInChangeLog type="updated">
          <Row/>
        </ForEachItemInChangeLog>
      </Table>
    </Section>

...

</Report>


Example Result


Setting No Border

To remove the default table border, use the table <CellBorderWidth> tag set to "0". The tag should be located within the <Table>.


Example Configuration

<Table>
<Options>
    <CellBorderWidth>0</CellBorderWidth>
</Options>
...


Example Result


Formatting the Table Header

To apply formatting to a table header, use the table's Header tag. The Header tag is optional.


<Header visible="" color="" font="" para=""/>


Hiding the Table Header

Visible defines whether the header will be visible or not. 


Setting a Background Color

Color specifies the visibility and background color of the table header. See Defining Color in Configurations for valid color values.


Specifying Font and Paragraph Styles

Font specifies the FontStyles of the table header. 

Para specifies the ParaStyles of the table header.


The default header format of a <Table> is shown below. 


Example Configuration

In this example of a change log, the header color, size, font and space before is set using the Header tag.


<Report>

    <ParaStyles>
        <ParaStyle name="pstyle1" alignment="center" spaceBefore="20"/>
    </ParaStyles>
    <FontStyles>
        <FontStyle name="fstyle1" style="bold" font="Times New Roman" size="14" color="gray"/>
        <FontStyle name="fblack" style="bold" font="Times New Roman" size="14" color="black"/>
    </FontStyles> 

    <Section title="ChangeLog using table">
        <ForEach select="/5IRS/REQS">
            <AddToChangeLog/>
        </ForEach>
        <Section title="New items">
            <Table>
                <Header visible="true" color="#99CC00" font="fstyle1" para="pstyle1"/>
                <Columns>
                    <ItemNameColumn width="150"/>
                    <ItemTypeColumn width="100"/>
                    <TextColumn width="100" caption="Last Changed By">#{? LastChangedBy.RealName }</TextColumn>
                    <ItemLastChangedColumn caption="Last Changed" format="yyyy-mm-dd" width="100"/>
                </Columns>
                <ForEachItemInChangeLog type="new">
                    <Row/>
                </ForEachItemInChangeLog>
            </Table>
        </Section>
        <Section title="Updated items">
            <Table>
                <Header visible="true" color="#FFFF00" font="fstyle1" para="pstyle1"/>
                <Columns>
                    <ItemNameColumn width="150"/>
                    <ItemTypeColumn width="100"/>
                    <TextColumn width="100" caption="Last Changed By">#{? LastChangedBy.RealName }</TextColumn>
                    <ItemLastChangedColumn caption="Last Changed" format="yyyy-mm-dd" width="100"/>
                    <!--TextColumn width="50" caption="PageNo">#{Referent.PageNo}</TextColumn-->
                </Columns>
                <ForEachItemInChangeLog type="updated">
                    <Row/>
                </ForEachItemInChangeLog>
            </Table>
        </Section>
        <Section title="Deleted items">
            <Table>
                <Header visible="true" color="#e43a39" font="fblack" para="pstyle1"/>
                <Columns>
                    <ItemNameColumn width="150"/>
                    <ItemTypeColumn width="100"/>
                    <TextColumn width="100" caption="Last Changed By">#{? LastChangedBy.RealName }</TextColumn>
                    <ItemLastChangedColumn caption="Last Changed" format="yyyy-mm-dd" width="100"/>
                </Columns>
                <ForEachItemInChangeLog type="deleted">
                    <Row/>
                </ForEachItemInChangeLog>
            </Table>
        </Section>
    </Section>
</Report>

Example Result


Adding a Table Caption

Tables also have an optional Caption tag to set a leading caption for the table. 


Example Configuration

In this example, the caption is the current item name, i.e., "Function Requirements"


<Report>
  <Section title="ChangeLog using table"> 
    <ForEach select="/5IRS/REQS">
      <AddToChangeLog/>
    </ForEach>
    <Section>
      <Table>
        <Header visible="true" color="aqua" para="pstyle1"/>
        <Caption>#{Name}</Caption>
        <Columns>
          <ItemNameColumn width="150"/>
          <ItemTypeColumn width="100"/>
          <TextColumn width="110" caption="Last Changed By">#{? LastChangedBy.RealName }</TextColumn>
          <ItemLastChangedColumn caption="Last Changed" format="yyyy-mm-dd" width="100"/>
        </Columns>
        <ForEachItemInChangeLog type="deleted">
          <Row/>
        </ForEachItemInChangeLog>
      </Table>
    </Section>
  </Section>
</Report>

Example Result