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:
Gridname[GridCategory].Qname.Categories[Category].Style.Cell.BorderStyle = BorderStyles.Type
where:
▪Gridname is the name of the grid.
▪GridCategory is the name of a category for which Qname is repeated (that is, one of the categories named at the start of the grid definition). If the setting applies to all categories, use [..].
▪Qname is the name of the repeated question.
▪Category is the name of a response in Qname’s response list. Use [..] to refer to all responses.
▪Type is the border type and is one of:
Property
|
Description
|
bsDouble
|
A pair of wide and narrow lines all the way round the cell. |
bsGroove
|
The border looks like a groove cut into the page. |
bsInset
|
The border appears to be set or engraved into the page. |
bsNone
|
No borders. This is the default.
|
bsOutset
|
The border appears to stand out from the page. |
bsRidge
|
The border looks like a picture frame around the cell. |
bsSolid
|
A single solid line. |
To create a grid in which all body cells are surrounded by a double border you would type:
TeaLoop[..].Countries.Categories[..].Style.Cell.BorderStyle = _ BorderStyles.bsDouble
Grid with all cells enclosed in double borders
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:
Notice how 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 may want to choose a color to replace the default grey. The syntax for border color changes is:
Gridname[GridCategory].Qname.Categories[Category].Style.Cell.BorderColor = "color"
where:
▪Gridname is the name of the grid.
▪GridCategory is the name of a category for which Qname is repeated (that is, one of the categories named at the start of the grid definition). If the setting applies to all categories, use [..].
▪Qname is the name of the repeated question.
▪Category is the name of a response in Qname’s response list. Use [..] to refer to all responses.
▪color is the name or RGB value of the border color. For a complete list of the color names that you can use and their equivalent RGB (hexadecimal) values, refer to your HTML documentation.
Alternatively, replace BorderColor with one of 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
Here is the grid with green double borders. The statement that sets the color is:
TeaLoop[..].Countries.Categories[..].Style.Cell.BorderColor = "#81FF93"
Grid with alternating dark and bright green column borders
Here is the same grid with alternating dark and bright green borders for columns:
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"
Notice how the interviewing program deals with borders that are common to two adjacent cells. It 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 alter it for individual borders. To specify a border width for the whole grid, type:
Gridname[GridCategory].Qname.Categories[Category].Style.Cell.BorderWidth = width
where:
▪Gridname is the name of the grid.
▪GridCategory is the name of a category for which Qname is repeated (that is, one of the categories named at the start of the grid definition). If the setting applies to all categories, use [..].
▪Qname is the name of the repeated question.
▪Category is the name of a response in Qname’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 may not display correctly simply 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