Deviating table styling

Deviating styling

If you want a table to deviate from the styling settings applied at a higher level (e.g., the level of a clause, document, or user defaults), you can insert an optional very first row, in which the only cell contains one or more (each separated by a comma) of the settings listed in this article between % … %.

– unit can be either 0 (zero — to remove something), cm (centimers), mm (millimeters), i (inch), pt (points, the typical measurement unit for fonts) or px (pixels, the typical measurement unit for images on screen);

– hex refers to the CSS hex format, which is a combination of either 3 or 6 hex characters (a number or a / b / c / d / e). For example, #FF0000 is pure red, while #22B61E is a green variant. There are numerous websites and software programs that can help you find the right color — see for example https://htmlcolorcodes.com/ or https://www.w3schools.com/colors/colors_hexadecimal.asp
To be clear: the deviating styling row should be the very first row, and should only contain a single cell. If you add more cells, ClauseBase will get confused, or consider the row to be a regular row.

General

  • align left, align right, align center or align full width — set the alignment
    • align left, align center and align right can be followed by a number between 1 and 100 to set the relative width vis-à-vis the page (e.g., align right 30 results in a right-aligned table of 30% page width)
  • background #hex — sets the background of the table — i.e., every cell but the cells of the header row and header columns — to the specified color
    • for example, background #00ff00 would set the background color of those cells to pure green
  • borders amount unit — sets the width of the outside borders
    • for example, borders 5px sets the four outside borders to 5 pixels
  • borders #hex — sets the color of the outside borders to the specified hex color
    • for example, borders #aabbcc would set the colors of the outside borders to blueish gray
  • borders true and borders false enables or disables the outside borders
  • borders horizontal/vertical amount unit — sets the width of either the horizontal lines between each row or the vertical lines between the columns
    • for example, borders horizontal 1mm would set each inside horizontal line to 1 millimeter
    • borders vertical 0 would remove the inside vertical lines
  • borders horizontal/vertical #hex — sets the color of either the horizontal lines between each row or the vertical lines between the columns
    • for example, borders vertical #fff would set each inside vertical line to white
  • distribution auto — results in a table with an automatic width, determined to fit its contents
  • distribution evenly — results in a table where all the columns have an equal width
  • distribution 10, distribution 20, distribution 30 or distribution 50 — results in a table where the first column has the specified relative width percentage, while all the other columns equally share the rest of the available space
    • for example, distribution 10 in a table with four columns would result in a table where the first column has 10% of the width, while the second, third and fourth column would each have 30% of the width
  • distribution x/y/z… — results in a table where the first column has width x%, the second column relative width y%, the third column relative width z% etc.
    • for example, distribution 20/30/40/50 results in a table where the first column has 20% width, the second 30%, the third 40% and the fourth 50%
  • header background #hex — sets the background-color of the header rows and header columns (i.e., columns for which a ======= was inserted in the divider row)
    • for example, header background #aaa would set the header background to medium gray
  • width x — sets the width of the page relative to the page
    • for example, width 30 sets the width to 30% of the page width

Multi-cell styling

ClauseBase also allows you specify the styling of several cells at once, by specifying a location and a styling.

The locations can be any of the following:

  • top left celltop right cellbottom left cell and bottom right cell
  • first row refers to all the cells of the top row
  • last row refers to all the cells of the last row
  • first column refers to all the cells of the leftmost column of the table
  • last column refers to all the cells of the rightmost column of the table
  • odd rows refers to all the cells of every odd row (i.e., the first row, third row, fifth row, etc.)
  • even rows refers to all the cells of every even row (i.e., the second, fourth, sixth, etc. row)
  • odd columns refers to all the cells of every odd column (i.e., the first, third, fifth columns, etc.)
  • even columns refers to all the cells of every even column (i.e., the second, fourth, sixth, etc. column)

The styling can be any of the following:

  • italic true / false sets the style to italic (you can also leave out the true, it is implied)
  • bold true / false sets the style to bold (you can also leave out the true, it is implied)
  • underline true / false sets the style to underlined (you can also leave out the true, it is implied) 
  • font #hex sets the font color
  • fontfont-name sets the font family (font-name can be either Arial, Arial Black, Arial Narrow, Cambria, Calibri, Courier, Georgia, Gill Sans, Impact, Palatino, Tahoma, Times, Trebuchet or Verdana)
  • background #hex sets the background-color of each cell
  • border left/right/top/bottom #hex sets the color of the specified border, while border #hex sets the color of all four borders at once
  • border left/right/top/bottom amount unit sets the width of the specified border, while border amount unit sets the width of all four borders at once
  • borders horizontal/vertical #hex sets the color of either the horizontal lines between each row, or the vertical lines between each column
  • borders horizontal/vertical amount unit sets the width of either the horizontal lines between each row, or the vertical lines between each column
For the first/last/even/odd columns, the top border refers to the single line at the top of the first cell in the column, while the bottom border refers to the single line at the bottom of the last cell of the column. If you wan to refer to the lines at the top and bottom of every other cell in the column, you have to refer to the borders horizontal.

Similarly, the border left/right of first / last / even / odd rows refers to the single lines at the left and right of respectively the leftmost and rightmost cell, while the borders vertical refer to the left/right of every other cell of the row.

Examples

The following code sets the first row to bold, not underlined, with a red background and white letters: (The underline false is only relevant if some other styling setting with less precedence — e.g., the default styling of the company — would specify underlining by default.

|| % first row bold true, first row underline false, first row font #fff, first row background #ff0000 % ||
|| Example row 1, cell 1 || Example row 1, cell 2 ||
|| Example row 2, cell 1 || Example row 2, cell 2 ||

The following code sets the width of the left border of the top row to 4mm and ensures at the same time that all the cells of the last row will have a red background:

|| % first row border left 4mm, last row background #ff0000 % ||
|| Example row 1, cell 1 || Example row 1, cell 2 ||
|| Example row 2, cell 1 || Example row 2, cell 2 ||

Some combinations of instructions will be conflicting. For example, specifying that the cells of the first row should have a yellow background, while at the same time specifying that the cells of the first column should have a red background, raises the question which color the top left cell should get. The answer is that locations mentioned earlier in the bullet-list above (in casu the first row) will have precedence.
Was this article helpful?
Dislike
Introduction to tables
File position