GenerateDocument [nb]
generates a document by evaluating all template elements in the notebook nb.
GenerateDocument [nb,args]
generates a document using args to fill template slots.
GenerateDocument [nb,output]
writes the generated document in the output file represented by output.
GenerateDocument [nb,args,output]
uses args to fill template slots and puts the result in output.
GenerateDocument
GenerateDocument [nb]
generates a document by evaluating all template elements in the notebook nb.
GenerateDocument [nb,args]
generates a document using args to fill template slots.
GenerateDocument [nb,output]
writes the generated document in the output file represented by output.
GenerateDocument [nb,args,output]
uses args to fill template slots and puts the result in output.
Details
- The nb can be a notebook in any of the following forms:
-
Notebook a Notebook expression
- GenerateDocument [nb] and GenerateDocument [nb,args] return a notebook object.
- The output in GenerateDocument can be any of the following:
-
"!prog" export data to a pipe
- GenerateDocument typically works with template notebooks, which can usually be created interactively.
- If the notebook nb does not contain any template elements, GenerateDocument effectively operates like NotebookEvaluate .
- If the notebook nb contains template elements, GenerateDocument will fill template slots from args.
- A positional template slot i is filled from the i^(th) position of args.
- A named template slot "name" is filled from an element with key "name" in an association appearing in the first position of args.
- A blank template notebook suitable for use with GenerateDocument can be opened in the front end using CreateNotebook ["Template"].
Examples
open all close allBasic Examples (1)
Generate a notebook by evaluating template elements in a template notebook:
The template notebook:
The generated document:
Scope (1)
Template elements can iterate over lists of data to create repeating blocks:
Use the data in a template notebook:
The Repeating Block element in the template notebook:
The result of evaluating the repeating block element:
Generalizations & Extensions (5)
Generated documents may contain anything notebooks may contain, including interactive elements:
A copy of an interactive section of the generated report:
GenerateDocument can take the input template from a cloud object:
GenerateDocument can generate an output document deployed as a cloud object:
Generate a document as a cloud object with Permissions and MetaInformation :
Deploy a template as a cloud object:
Generate a document locally using the deployed template; deploy the result as a cloud object:
Applications (1)
Use a template to programmatically produce individualized outputs, as in a mail merge:
One of the generated documents:
See Also
TemplateApply NotebookTemplate XMLTemplate FileTemplate NotebookEvaluate NotebookPut Export DocumentGenerator
Function Repository: AutomaticReport
Related Workflows
Text
Wolfram Research (2014), GenerateDocument, Wolfram Language function, https://reference.wolfram.com/language/ref/GenerateDocument.html (updated 2020).
CMS
Wolfram Language. 2014. "GenerateDocument." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/GenerateDocument.html.
APA
Wolfram Language. (2014). GenerateDocument. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GenerateDocument.html
BibTeX
@misc{reference.wolfram_2025_generatedocument, author="Wolfram Research", title="{GenerateDocument}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/GenerateDocument.html}", note=[Accessed: 18-November-2025]}
BibLaTeX
@online{reference.wolfram_2025_generatedocument, organization={Wolfram Research}, title={GenerateDocument}, year={2020}, url={https://reference.wolfram.com/language/ref/GenerateDocument.html}, note=[Accessed: 18-November-2025]}