# US 2013/0159840 A1 · Document template dynamic token population

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2013/0159840 A1
- Document ID: US20130159840A1
- Status: Published application
- Kind: A1
- Application number: 13/327,789
- Filed: 2011-12-16
- Published: 2013-06-20
- Earliest claimed: 2011-12-16
- Assignees: Microsoft Corporation
- Inventors: Cosmin Nicolaescu
- Web page: https://patentgrep.com/patent/US20130159840A1

## CPC

- G06F 40/186: Templates
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A dynamic token system is described herein that allows the insertion of dynamic content into document templates that execute logic at run time to determine content to use to replace the token. A dynamic token is a generic mechanism to add content to a document body. Authors can implement a uniform defined interface, and reference a class containing custom software logic as a token in the document template. When a parser reaches that token, it invokes the dynamic token implementation, which has access to the entire payload and has the appropriate context to act accordingly. Each token can perform a very specific action, augment the payload if necessary, and output the desired information. This mechanism allows administrators to fulfill numerous requirements that are otherwise extremely complicated if not impossible. Thus, the system provides manageable, extensible document templates that can be applied to a wider variety of situations.

## Claims

### Claim 1

A computer-implemented method to apply one or more dynamic tokens in a document template, the method comprising:
parsing a received document template to identify one or more tokens that provide replacement data for part of the template, wherein at least one token is a dynamic token that causes dynamic determination of replacement data;
receiving payload information that specifies data associated with at least one instance of a document to be created based on the selected template;
detecting a reference to a dynamic token in the received document template;
locating a token handler that includes custom software code for generating replacement data for the detected dynamic token;
invoking the located token handler to execute custom software code associated with the dynamic token and generate replacement data for the dynamic token;
receiving replacement data as output from the invoked token handler; and
inserting the received replacement data into the created instance of the document based on the received document template,
wherein the preceding steps are performed by at least one processor.

### Claim 2 (depends on 1)

The method of claim 1 wherein parsing the received document template comprises receiving a selection of a document template through an interface provided to users by the system.

### Claim 3 (depends on 1)

The method of claim 1 wherein parsing the received document template comprises loading the document template in a document object model (DOM) for enumerating the contents of the document template.

### Claim 4 (depends on 1)

The method of claim 1 wherein receiving payload information comprises receiving at least one of replacement text for predefined static tokens, conditional information that is used by dynamic tokens, and background information related to the purpose of creating the document instance.

### Claim 5 (depends on 1)

The method of claim 1 wherein receiving payload information comprises accessing payload information stored in a data store associated with the received document template.

### Claim 6 (depends on 1)

The method of claim 1 wherein detecting the dynamic token comprises, during parsing of the document template, discovering one or more tokens based on a particular text format that signals the presence of a particular token.

### Claim 7 (depends on 1)

The method of claim 1 wherein detecting the dynamic token comprises identifying a token type based on a name of the token.

### Claim 8 (depends on 1)

The method of claim 1 wherein locating the token handler comprises locating the token handler by using a name of the token discovered in the token reference within the selected template to identify the handler for the dynamic token.

### Claim 9 (depends on 1)

The method of claim 1 wherein locating the token handler comprises identifying a software class that implements behavior through software logic associated with the dynamic token.

### Claim 10 (depends on 1)

The method of claim 1 further comprising, upon locating the token handler, loading a module associated with the handler, creating an instance of the handler's class, and retrieving an entry point for invoking the handler.

### Claim 11 (depends on 1)

The method of claim 1 wherein receiving replacement data comprises invoking a function provided by the token handler that provides replacement data as an output parameter.

### Claim 12 (depends on 1)

The method of claim 1 wherein receiving replacement data comprises receiving replacement data that includes at least one embedded token and further comprising processing the replacement data to handle the embedded token.

### Claim 13 (depends on 1)

The method of claim 1 wherein inserting replacement data comprises creating an email message and further comprising sending the email message to an identified recipient.

### Claim 14

A computer system for document template dynamic token population, the system comprising:
a processor and memory configured to execute software instructions embodied within the following components;
a template data store that stores one or more document templates wherein at least one document template includes at least one reference a dynamic token with data populated by executing a dynamic token handler during processing of the template;
a template creation component that provides an interface to template creators to create and modify document templates and store the created or modified document templates in the template data store;
a template access component that provides access to templates stored in the template data store to template users for creation of documents based on the templates;
a token detection component that detects one or more tokens in a selected document template and processes the tokens to populate a document instance derived from the template with appropriate text or other data;
a handler identification component that identifies a software handler for an identified dynamic token referenced in the selected document template;
a token execution component that executes an identified software handler for an identified dynamic token in the selected document template; and
a document finalization component that finalizes the document instance derived from the selected document template after each of the token references in the template have been resolved.

### Claim 15 (depends on 14)

The system of claim 14 wherein the template data store provides access to template creators to store new templates and update previously created ones, and provides access to template users to populate a template for creation of document instances.

### Claim 16 (depends on 14)

The system of claim 14 wherein the template data store also stores generic payload data for populating static template tokens.

### Claim 17 (depends on 14)

The system of claim 14 wherein the token detection component invokes the handler identification component to identify an appropriate handler and the token execution component to retrieve replacement data for the token.

### Claim 18 (depends on 14)

The system of claim 14 wherein the token detection component also handles one or more types of static tokens that do not involve the execution of a custom token handler at run time.

### Claim 19 (depends on 14)

The system of claim 14 wherein the handler identification component detects a dynamic token reference that is a class name of a software class implemented in a program module.

### Claim 20

A computer-readable storage medium comprising instructions for controlling a computer system to create a tokenized template including one or more dynamic tokens, wherein the instructions, upon execution, cause a processor to perform actions comprising:
receiving a request to create a tokenized document template for creating document instances using replacement data from one or more replaceable tokens;
receiving a module that implements at least one dynamic token handler, wherein a dynamic token handler provides dynamically executable software code for determining contents of replacement data at run time during creation of a document instance based on the document template;
receiving template static content that defines at least part of a body of the template;
inserting at least one reference to a dynamic token into the document template; and
storing the created document template including the at least one reference to the dynamic token in a template data store.
