4

This question is strongly related to:

NotebookWrite Cell with Grid

Let’s create sample chart

mydata = {{"Noise Density \n(\[Mu]g/\!\(\*SuperscriptBox[\(Hz\), \
\(0.5\)]\))", "Mean", "StDev", "Min", "Q1", "Median", "Q3", 
"Max"}, {"X ", 5., 4., 21., 26., 29., 33., 35.}, {"Y ", 25., 5., 
18., 20., 25., 29., 34.}, {"Z ", 39., 4., 30., 38., 39., 40., 
47.}};


myChart = 
  Grid[mydata
, BaseStyle -> {FontFamily -> "Helvetica Neue"
, FontTracking -> "SemiCondensed", FontWeight -> “Thin”, FontSize -> 10}
, Frame -> True
, Dividers -> {{True, True}, {True, True}}
, Spacings -> {2, 1}
, Alignment -> {{Center, Left}, Right}
, Background -> {{1 -> LightGray}}]

The chart renders OK on evaluation:

sample chart

However, when I try to write the chart to a new document:

CreateDocument[ ExpressionCell@myChart]

It inserts it as follows:

Probelmatic chart

What is the correct method of writing a grid to a document?

Pam
  • 1,867
  • 11
  • 24
  • Does this work for what you need: CreateDocument[ExpressionCell[myChart, ShowStringCharacters -> False]]? – kglr Apr 18 '14 at 15:21
  • Great… if you post it as an answer that would be great… – Pam Apr 18 '14 at 15:26
  • @kguler: I can’t seem to do: SetOptions[ExpressionCell, ShowStringCharacters -> False]; and have it propagate through out my document creations… any ideas? – Pam Apr 18 '14 at 15:28
  • SetOptions[EvaluationNotebook[], ShowStringCharacters -> False] works? – kglr Apr 18 '14 at 16:17
  • Yes. That seems to work – Pam Apr 18 '14 at 20:13

2 Answers2

3
CreateDocument[ExpressionCell[myChart, ShowStringCharacters -> False]]

enter image description here

kglr
  • 394,356
  • 18
  • 477
  • 896
1

Use the expression cell style, "Print":-

CreateDocument[ExpressionCell[myChart, "Print"]]
Chris Degnen
  • 30,927
  • 2
  • 54
  • 108
  • "Output" will work too but with both there is a difference in CellMargins in comparision to simple ExpressionCell. – Kuba Apr 18 '14 at 16:50