Professional > Interview scripting > Writing interview scripts > Page layout facilities > Default styles > Default styles for grids
 
Default styles for grids
To define default styles for grid components, type:
IOM.DefaultStyles.Grids[GridStyleTypes.type].property = value
where:
type is one of the following grid components:
Grid component
Description
gsAltCol
Alternate columns
gsAltColHeader
Alternate column headers
gsAltRow
Alternate rows
gsAltRowHeader
Alternate row headers
gsCell
Grid cells
gsColHeader
Column headers
gsRowHeader
Row headers
property is the name of the property you want to specify.
value is the value of the property.
Example: Default styles for grid row and column heading cells and body cells
With IOM.DefaultStyles
.Grids[GridStyleTypes.gsCell].Cell.BgColor = "#C0C0FF" 'blue
.Grids[GridStyleTypes.gsColHeader].Cell.BgColor = "#40FFFF" 'cyan
.Grids[GridStyleTypes.gsRowHeader].Cell.BgColor = "#FF40FF" 'magenta
End With
creates grids with different background colors for the row and column heading cells and the body cells as shown in the following illustration:
Grid showing default styles for alternate columns
You can often make grids easier to follow if you use different colors for alternate rows or columns. Here are a couple of examples. The first grid uses alternate colors for column and column heading cells as well as a different typeface and font effect for the column headings. These things encourage respondents to look at the grid as a set of columns, and to choose all the teas that are grown in China before thinking about which teas are grown in India.
The statements that set the styles for this example are:
With IOM.DefaultStyles
.Grids[GridStyleTypes.gsColHeader].Font.Family = "'Comic Sans MS'"
.Grids[GridStyleTypes.gsColHeader].Font.Effects = FontEffects.feBold
.Grids[GridStyleTypes.gsColHeader].Cell.BgColor = "#C0C0FF" 'blue
.Grids[GridStyleTypes.gsCell].Cell.BgColor = "#C0C0FF" 'blue
.Grids[GridStyleTypes.gsAltCol].Cell.BgColor = "#C0FFC0" 'green
.Grids[GridStyleTypes.gsAltColHeader].Cell.BgColor = "#C0FFC0" 'green
End With
Grid showing default styles for alternate columns
The next example switches the emphasis from countries (columns) to tea types (rows) so that respondents are encouraged to think about each tea type in turn. The statements are the same as those you have just seen except that they refer to rows:
With IOM.DefaultStyles
.Grids[GridStyleTypes.gsRowHeader].Font.Family = "'Comic Sans MS'"
.Grids[GridStyleTypes.gsRowHeader].Font.Effects = FontEffects.feBold
.Grids[GridStyleTypes.gsRowHeader].Cell.BgColor = "#C0C0FF" 'blue
.Grids[GridStyleTypes.gsCell].Cell.BgColor = "#C0C0FF" 'blue
.Grids[GridStyleTypes.gsAltRow].Cell.BgColor = "#C0FFC0" 'green
.Grids[GridStyleTypes.gsAltRowHeader].Cell.BgColor = "#C0FFC0" 'green
End With
Grid with default styles for alternate rows and alternate columns
If you define defaults for both alternate rows and alternate columns in a grid with row orientation, the styles for alternate rows always override those for alternate columns regardless of the order in which the styles are defined. The following statements illustrate this. From reading the code you might expect the background colors to be set in the order they are defined, so that you would have pink alternate columns interspersed with columns of alternately blue and green cells.
With IOM.DefaultStyles
.Grids[GridStyleTypes.gsCell].Cell.BgColor = "#C0C0FF" 'blue
.Grids[GridStyleTypes.gsAltRow].Cell.BgColor = "#C0FFC0" 'green
.Grids[GridStyleTypes.gsAltCol].Cell.BgColor = "#FFC0C0" 'pink
End With
However, because rows always override columns when the grid uses row orientation, you get green alternate rows interspersed with rows of alternate blue and pink cells, as follows. This will always be the case even if you put the statements in a different order:
If the grid uses column orientation (in this example, the teas would be the columns and the countries would be the rows), then column specifications override row specifications, and you would have all-pink columns for Darjeeling, Lapsang Souchong, and Oolong rather than the all-green rows shown in the illustration.
See also
Default styles