Re: Writing a graphic to a notebook, cont
- To: mathgroup at smc.vnet.net
- Subject: [mg104696] Re: [mg104665] Writing a graphic to a notebook, cont
- From: John Fultz <jfultz at wolfram.com>
- Date: Sat, 7 Nov 2009 06:47:34 -0500 (EST)
- Reply-to: jfultz at wolfram.com
There's nothing fundamentally wrong with your NotebookWrite[] command, and it worked for me. If you're interested in pursuing why this didn't work, you'll have to provide more context. Sincerely, John Fultz jfultz at wolfram.com User Interface Group Wolfram Research, Inc. On Fri, 6 Nov 2009 05:16:54 -0500 (EST), Gerry Flanagan wrote: > As usual, I found the work around a few minutes after posting. I guess > the right way is to build all the cells first, then create the document > in one shot using CreateDocument. I was trying to create a document, > then write to it cell by cell. Should work, and I still don't understand > why it doesn't, but CreateDocument combined with ExpressionCell does > what I want. > GF > > How do you send a graphic to a notebook under program control? For > example, taking the documentation example > CellPrint[Cell[BoxData[ToBoxes[Plot[Sin[x], {x, -2, 2}]]], "Output"]] > and changing to > NotebookWrite[nb, Cell[BoxData[ToBoxes[Plot[Sin[x], {x, -2, 2}]]], > "Output"]] > gives an error message (nb is a previously created notebook object). > > I think I've seen this somewhere, and remember it was pretty obscure. > Surprising that anything to works inside CellPrint would not work inside > NotebookWrite. > Gerry F.