3
$\begingroup$

I wish the DateObject[{2019, 8, 27}] function and TimeObject[{2, 35}] function could be visible on my grid.

data={{"CaixaPokémon",DateObject[{2019,8,27}],22.41,TimeObject[{2,35}]},{"second",11,5,6},{"third",111,8,9},{"fourth",1111,10,11}};
Text@Grid[Prepend[data,{"Projeto","Data","Metros","Tempo"}],Background->{None,{Lighter[Yellow,.9],{White,Lighter[Blend[{Blue,Green}],.8]}}},
Dividers->{{Darker[Gray,.6],{Lighter[Gray,.5]},Darker[Gray,.6]},{Darker[Gray,.6],Darker[Gray,.6],{False},Darker[Gray,.6]}},Alignment->{{Center,Center,{Center}}},ItemSize->{{10,3,5,5}},Frame->Darker[Gray,.6],ItemStyle->14,Spacings->{15,.8}]

enter image description here

Is there anything else I should do for better viewing?

$\endgroup$
1
  • 3
    $\begingroup$ The culprit is your choice of ItemSize->{{10,3,5,5}}, values here for 2nd and last columns are not enough. You may change this to ItemSize -> {{10, Full, 5, Full}} to prevent line-wrapping as the help page says. Or simply use ItemSize->Full so that every item is at its full width and height. $\endgroup$
    – Alx
    Sep 6, 2019 at 0:27

2 Answers 2

3
$\begingroup$

You can also wrap the grid object with Style using the option LineBreakWithin -> False:

Style[#, LineBreakWithin -> False] &@
 Grid[Prepend[data, {"Projeto", "Data", "Metros", "Tempo"}], 
  Background -> {None, {Lighter[Yellow, .9], {White, Lighter[Blend[{Blue, Green}], .8]}}}, 
  Dividers -> {{Darker[Gray, .6], {Lighter[Gray, .5]}, Darker[Gray, .6]}, 
     {Darker[Gray, .6], Darker[Gray, .6], {False},  Darker[Gray, .6]}},
  Alignment -> {{Center, Center, {Center}}}, 
  Frame -> Darker[Gray, .6], ItemStyle -> 14, Spacings -> {15, .8}]

enter image description here

With Spacings -> {1, .8} we get:

enter image description here

$\endgroup$
2
$\begingroup$

As recommended by our contributor Alx:

data = {{"CaixaPokémon", DateObject[{2019, 8, 27}], 22.41, 
    TimeObject[{2, 35}]}, {"second", 11, 5, 6}, {"third", 111, 8, 
    9}, {"fourth", 1111, 10, 11}};
Text@Grid[Prepend[data, {"Projeto", "Data", "Metros", "Tempo"}], 
  Background -> {None, {Lighter[Yellow, .9], {White, 
      Lighter[Blend[{Blue, Green}], .8]}}}, 
  Dividers -> {{Darker[Gray, .6], {Lighter[Gray, .5]}, 
     Darker[Gray, .6]}, {Darker[Gray, .6], Darker[Gray, .6], {False}, 
     Darker[Gray, .6]}}, Alignment -> {{Center, Center, {Center}}}, 
  ItemSize -> {{10, Full, 5, Full}}, Frame -> Darker[Gray, .6], 
  ItemStyle -> 14, Spacings -> {15, .8}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.