Working with Outer Document Insertion

Note
The code uses some of the objects defined in The Business Layer.

Inserting Documents Dynamically

You can insert contents of outer documents into your reports dynamically using doc tags. A doc tag denotes a placeholder within a template for a document to be inserted during run-time.

<<doc [document_expression]>>
Warning
A doc tag can be used almost anywhere in a template document except text-boxes and charts.

An expression declared within a doc tag is used by the engine to load a document to be inserted during run-time. The expression must return a value of one of the following types:

  • A byte array containing document data
  • A Stream instance able to read document data
  • An instance of the Document class
  • A string containing a document URI
Warning
If an expression declared within a doc tag returns a stream object, then the stream is closed by the engine as soon as a corresponding document is loaded.

By default, a document being inserted is not checked against template syntax and is not populated with data. However, you can enable this by using a build switch as follows.

<<doc [document_expression] -build>>

When a build switch is used, the engine treats a document being inserted as a template that can access the following data available at the scope of a corresponding doc tag:

Tip
For detailed technical information about syntax, expressions and report generation by the engine, please visit: Working with GroupDocs.Assembly Engine

Working with Outer Document Insertion 

Download Templates

Get designed and outer templates from here.

The Code

Outer Document Insertion in Word Processing Formats

Note
This feature is supported by version 18.12 or greater.

Download Templates

Get designed and outer templates from here.

The Code

Outer Document Insertion in Email Formats

Note
This feature is supported by version 18.12 or greater.

Download Templates

Get designed and outer templates from here.

The Code