Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Page layout facilities > Styles > Grids > Cell borders
 
Cell borders
Borders are the lines that appear around the cells of the grid. To display them, set the Cell.BorderStyle property to the type of border you want:
<grid_name>[<grid_category>].<question_name>.Categories[<category>].Style.Cell.BorderStyle = BorderStyles.<type>
where:
<grid_name> is the name of the grid.
<grid_category> is the name of a category for which <question_name> is repeated (that is, one of the categories named at the start of the grid definition). If the setting applies to all categories, use [..]
<question_name> is the name of the repeated question.
<category> is the name of a response in <question_name>’s response list. Use [..] to refer to all responses.
<type> is the border type, is one of:
Property
Description
bsDouble
A pair of wide and narrow lines all the way round the cell.
This graphic is described in the surrounding text.
bsGroove
The border looks like a groove cut into the page.
This graphic is described in the surrounding text.
bsInset
The border appears to be set or engraved into the page.
This graphic is described in the surrounding text.
bsNone
No borders. This is the default.
bsOutset
The border appears to stand out from the page.
This graphic is described in the surrounding text.
bsRidge
The border looks like a picture frame around the cell.
This graphic is described in the surrounding text.
bsSolid
A single solid line.
This graphic is described in the surrounding text.
To create a grid in which all body cells are surrounded by a double border, type:
TeaLoop[..].Countries.Categories[..].Style.Cell.BorderStyle = _ BorderStyles.bsDouble
Grid with all cells enclosed in double borders
This graphic is described in the surrounding text.
You can set different styles for the four borders of a cell by using the property names BorderTopStyle, BorderBottomStyle, BorderLeftStyle, and BorderRightStyle instead of BorderStyle. You might do this when you want a border around the outside of the grid body cells and no borders between the cells inside the grid. For example:
TeaLoop[..].Countries.Categories[{China}].Style.Cell.BorderLeftStyle = _ BorderStyles.bsSolid TeaLoop[..].Countries.Categories[{SriLanka}].Style.Cell.BorderRightStyle = _ BorderStyles.bsSolid TeaLoop[{Assam}].Countries.Categories[..].Style.Cell.BorderTopStyle = _ BorderStyles.bsSolid TeaLoop[{Oolong}].Countries.Categories[..].Style.Cell.BorderBottomStyle = _ BorderStyles.bsSolid
produces a grid with outside border only:
This graphic is described in the surrounding text.
The statements for the top and bottom of the grid refer to tea types, while the statements for the sides of the grid refer to countries. This is because, for the top and bottom of the grid, the border belongs to all countries (columns) but to only one tea type (row). For the sides of the grid, the border belongs to all tea types (rows) but only one country (column).
If you use the standard BorderStyle together with any of the more specific settings, BorderStyle will be used as the default for borders that have no style specifically defined.
Border color
Having switched on borders, you can choose a color to replace the default grey. The syntax for border color changes is:
<grid_name>[<grid_category>].<question_name>.Categories[Category].Style.Cell.BorderColor = "<color>"
where:
<grid_name> is the name of the grid.
<grid_category> is the name of a category for which <question_name> is repeated (that is, one of the categories named at the start of the grid definition). If the setting applies to all categories, use [..].
<question_name> is the name of the repeated question.
<category> is the name of a response in <question_name>’s response list. Use [..] to refer to all responses.
<color> is the name or RGB value of the border color.
You can use BorderTopColor, BorderBottomColor, BorderLeftColor, or BorderRightColor to set the color for a particular border only. If you use a combination of BorderColor and any of the more specific settings, BorderColor will be used as the default for borders that have no color specifically defined.
Grid with green double border on all cells
The following example creates a grid with green double borders:
TeaLoop[..].Countries.Categories[..].Style.Cell.BorderColor = "#81FF93"
This graphic is described in the surrounding text.
Grid with alternating dark and bright green column borders
Here is the same grid with alternating dark and bright green borders for columns:
This graphic is described in the surrounding text.
The statements that set the colors are:
TeaLoop[..].Countries.Categories[..].Style.Cell.BorderColor = "#05FB05"
TeaLoop[..].Countries.Categories[{China}].Style.Cell.BorderColor = "#226E22"
TeaLoop[..].Countries.Categories[{Japan}].Style.Cell.BorderColor = "#226E22"
TeaLoop[..].Countries.Categories[{SouthAfrica}].Style.Cell.BorderColor = "#226E22"
When borders are common to two adjacent cells, the program draws the cells for the left-most column in full and then appends whatever borders are required for the next column, applying the color for the next column only to the borders that it needs to add. This is why all columns except the first one have only three borders in the specified color. A similar rule applies to row borders treated in this way. Only the top row has all four borders in the specified color; other rows have their borders added to what is already there.
Border width
The final setting you can make for borders is width and, as with style and color, you can define a global border width and then change it for individual borders. To specify a border width for the whole grid, type:
<grid_name>[<grid_category>].<question_name>.Categories[<category>].Style.Cell.BorderWidth = <width>
where:
<grid_name> is the name of the grid.
<grid_category> is the name of a category for which <question_name> is repeated (that is, one of the categories named at the start of the grid definition). If the setting applies to all categories, use [..].
<question_name> is the name of the repeated question.
<category> is the name of a response in <question_name>’s response list. Use [..] to refer to all responses.
<width> is the line width in pixels.
To specify individual border widths, replace BorderWidth with one of BorderTopWidth, BorderBottomWidth, BorderLeftWidth, or BorderRightWidth. If you use a combination of BorderWidth and one or more of the more specific settings, BorderWidth will be used as the default for borders that have no width specifically defined.
All the illustrations in this topic have been created using the default width:
TeaLoop[..].Countries.Categories[..].Style.Cell.BorderWidth = 4
If you choose a smaller width, some border styles might not display correctly because there is not enough room for them. For instance, with a width of 1, the bsDouble setting displays a single line only.
See also
Grids