Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

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


  • 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?