in-kernel notebook manipulation problem
- To: mathgroup at smc.vnet.net
- Subject: [mg38508] in-kernel notebook manipulation problem
- From: Gerald Roth <gerald.roth at aon.at>
- Date: Fri, 20 Dec 2002 04:27:52 -0500 (EST)
- Organization: University of Graz, Austria
- Sender: owner-wri-mathgroup at wolfram.com
hi
i am having BIG troubles with a function that does the following:
read in a Notebook in the kernel (Get[...]) -> Extracting some Cells
(Cases[...] -> Manipulating the Cells -> Writing them back into the
Notebook->Exporting the Notebook.
The way it is done looks like this:
nbk = Get at ToFileName[...path...];
...
Extraction of Cells, Manipulation.. finally i have a list of Cells:
nbcells={Cell[...], Cell[...],...}
...
the cells are inserted into the notebook with the following command:
nbk=nbk/.Notebook[{cont__Cell},nbopts__Rule] ->
Notebook[{Cell[CellGroupData[nbcells,Open]], cont}, nbopts];
afterwards the notebook is exported via
Export[..filename.., nbk[[1]],"NB"];
( i am using mathematica 4.2 windows - therefore the Export[], and the[[1]] is
necessary because after the replacement i have nbk={Notebook[...]} )
now the problem is: the cells get insetred correctly, but the notebook options
are gone. if i open the exported notebook with a text editor, there are no
options present in the Notebook[] expression. the replacement seems to be
part where something goes definitly wrong, but i don't see what it is...
I tried several other constructs for the replacement ( RuleDelayed, many
different things with HoldPattern[], etc, but nothing worked. my last try was
something like
cont=nbk[[1]],
nbopts=Options[nbk]
cont=Prepend[cont, Cell[CellGroupData[nbcells,Open]]];
nbk=Notebook[cont,Sequence@@nbopts];
it didn't work either.
please help me out!
thanks in advance
gerald
--
*************************************
Gerald Roth
M@th Desktop Development
Tel: +43 - 316 - 57 16 33
Email: Gerald.Roth at aon.at
*************************************