MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Can I assign a style to a GridBox row?


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


  • Prev by Date: Re: Mathematica code & Latex
  • Next by Date: Re: Coefficients from Fit as a list?
  • Previous by thread: Can I assign a style to a GridBox row?
  • Next by thread: Re: Can I assign a style to a GridBox row?