Notebook Document Processing
Since Version 3, notebooks have been saved as symbolic expressions that can easily be loaded and processed into the Wolfram Language, but doing so requires a significant understanding of the notebook's symbolic representation. NotebookImport clears that hurdle by making it simple to pull text, graphics, and code from notebooks.
Import all "Notes"-styled cells found in the documentation for Cos, convert them to plain text strings, and return them in a nicely formatted table.
show complete Wolfram Language input
In[2]:=
makeGrid[Text /@ NotebookImport[docNotebook, "Notes" -> "Text"]]
Out[2]=
Samples of all extracted inputs.
In[3]:=
makeGrid[Take[NotebookImport[docNotebook, "Input"], 9]]
Out[3]=
Show the inputs in "InactiveExpression" form.
In[4]:=
makeGrid[Take[
NotebookImport[docNotebook, "Input" -> "InactiveExpression"], 9]]
Out[4]=
Samples of all the graphical outputs.
In[5]:=
Take[Cases[
NotebookImport[docNotebook,
"Output"], _Graphics | _Image | _Graphics3D], 4]
Out[5]=
Samples of all extracted example texts.
In[6]:=
makeGrid[Take[NotebookImport[docNotebook, "ExampleText" -> "Text"],
9]]
Out[6]=