WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

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
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Generalizations & Extensions  
Applications  
See Also
Related Guides
Related Workflows
History
Cite this Page

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:
  • "file" or File ["file"] explicit file name
    CloudObject [] a cloud object
    LocalObject [] a local object
    Notebook a Notebook expression
  • GenerateDocument [nb] and GenerateDocument [nb,args] return a notebook object.
  • The output in GenerateDocument can be any of the following:
  • "file" or File ["file"] explicit file name
    "!prog" export data to a pipe
    CloudObject [] a cloud object
    LocalObject [] a local object
  • 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 all

Basic 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:

Wolfram Research (2014), GenerateDocument, Wolfram Language function, https://reference.wolfram.com/language/ref/GenerateDocument.html (updated 2020).

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]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /