Re: Exporting the Notebook expression corresponding to a DocumentNotebook
- To: mathgroup at smc.vnet.net
- Subject: [mg81652] Re: Exporting the Notebook expression corresponding to a DocumentNotebook
- From: David Reiss <dbreiss at gmail.com>
- Date: Sun, 30 Sep 2007 04:06:41 -0400 (EDT)
- References: <fdi716$rte$1@smc.vnet.net><fdl9lq$d5q$1@smc.vnet.net>
Alas that won't work properly because the notebook that you then export would have the optoin Visible->False. Open it and, voila! ... nothing appears... But, to take your idea one step further, one could then Import the notebook as a notebook expressoin, do a pattern matching transformation on it to change Visible->False to Visible->True and then re-Export it. That is a pretty Baroque way to go about it--and for large notebooks it requires pulling big tings into memory--but it would work. Thanks, David http://scientificarts.com/worklife A WorkLife FrameWork E x t e n d i n g MATHEMATICA's Reach... On Sep 29, 6:33 am, "Steve Luttrell" <steve at _removemefirst_luttrell.org.uk> wrote: > You could create a notebook with an invisible window. > > CreateDocument[DocumentNotebook[{x+y,1/x+1/y}],Visible->False] > > -- > Steve Luttrell > West Malvern, UK > > "David Reiss" <dbre... at gmail.com> wrote in message > > news:fdi716$rte$1 at smc.vnet.net... > > > Hello Men and Women... > > > Here is something that is perhaps a useful thing to include in a > > future version of Mathematica. Does anyone know how to do this with > > the current functionality of Mathematica 6? > > > I'd like a function called ToNotebookExpression that takes the results > > of a DocumentNotebook, for example > > > docnb=DocumentNotebook[{x + y, 1/x + 1/y}]; > > > and returns the Notebook expression corresponding to it. > > > The following does do this, but it has to display the notebook in the > > front end first: > > > Module[{nb,nbg}, > > > nb=CreateDocument[ docnb]] > > nbg=NotebookGet[nb]; > > NotebookClose[nb]; > > nbg > > ] > > > One reason for wanting this, is that I'd like to create a > > DocumentNotebook inside of a program and then use Export to write the > > Notebook out to a .nb file. (Of course I can create the > > NotebookExpressoin using lower-level constructs, but I want to take at > > more Mathematica 6-ish path to this.) If one does Export["file.nb", > > docnb,"NB"] then the resulting saved notebook has the embedded > > DocumentNotebook expression, rather than what is generated when acting > > with CreateDocument[docnb]. > > > Any thoughts, or is this what I need to do for now? > > > Either way, I pass this on to WRI as a suggestion for a > > ToNotebookExpression-like function. > > > --David > > >http://scientificarts.com/worklife > > A WorkLife FrameWork > > E x t e n d i n g MATHEMATICA's Reach...