Re: Can I assign a style to a GridBox row?
- To: mathgroup at smc.vnet.net
 - Subject: [mg63418] Re: Can I assign a style to a GridBox row?
 - From: BGHEkaya at gmail.com
 - Date: Fri, 30 Dec 2005 02:32:34 -0500 (EST)
 - References: <dp06bc$ge5$1@smc.vnet.net>
 - Sender: owner-wri-mathgroup at wolfram.com
 
One way is to make use of nested GridBoxes: First let's massage your
data:
data={{Unknown Origin, 58, 100.}, {Sweden, 81, 1.23457}, {Scotland,
1826,
    1.09529}, {Great Britain, 221, 0.904977}, {Netherlands, 117,
    0.854701}, {Ireland, 1915, 0.626632}, {Spain, 165, 0.606061},
{Germany,
    1064, 0.56391}, {England, 4349, 0.436882}, {France, 271,
    0.369004}, {United Kingdom,
      889, 0.224972}} /.{x_,y_Integer,
        z_Real}->{x,y,NumberForm[z,{3,4}]}
We define a function that creates the GridBox for each row:
tableRow[data_List] := {StyleBox[GridBox[{data}, ColumnWidths ->
      10, ColumnAlignments -> {Left, Center, Center}], Background ->
If[OddQ[
        i], GrayLevel[0.8], GrayLevel[0.5]]]}
Then we nest the above GridBoxes in the 'mother GridBox':
DisplayForm[FrameBox[GridBox[Table[tableRow[data[[i]]], {
      i, 1, Length[data]}]]]]
Cheers,
Brian