Exporting the Notebook expression corresponding to a DocumentNotebook
- To: mathgroup at smc.vnet.net
- Subject: [mg81591] Exporting the Notebook expression corresponding to a DocumentNotebook
- From: David Reiss <dbreiss at gmail.com>
- Date: Fri, 28 Sep 2007 02:18:02 -0400 (EDT)
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...