Re: Writing a graphic to a notebook, cont
- To: mathgroup at smc.vnet.net
- Subject: [mg104702] Re: [mg104665] Writing a graphic to a notebook, cont
- From: Gerry Flanagan <flanagan at materials-sciences.com>
- Date: Sat, 7 Nov 2009 06:48:43 -0500 (EST)
- References: <20091167611.787741@jfultz2winlap>
Weird, Works for me now also. Something must of have happened to the open notebook that a new morning fixed. GF John Fultz wrote: 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 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.