Choosing a Generator
Verified against source (27)
docs/merge-use-cases.mdqbo4.Document/MergeService.csqbo4.Document.Bridge/BridgeGenerator.csqbo4.Document.Bridge/ZipGeneratorCore.csqbo4.Document.AsposeWords/WordMerge.csRegionMerge.cs (branch fix/word-merge-regions)WordMergeFacts.cs (branch fix/word-merge-regions)qbo4.Document.AsposeCells/ExcelMerge.csExtensions/WorkbookExtensions.csExtensions/RangeExtensions.csqbo4.Document.Aspose.Bridge/MethodSignatureProcessor.csqbo4.Document.Aspose.Bridge.Tests/CellsGeneratorFacts.csqbo4.Document.Aspose.Bridge.Tests/MethodSignatureProcessorFacts.csqbo4.Document.AsposePDF/PdfMerge.csExtensions/PdfDocumentExtensions.csqbo4.Document.Archive/ZipMerge.csqbo4.Document.DotNetZip/ZipMerge.csqbo4.Document.AI/AiMerge.csqbo4.Document.AI/AiMergeOptions.csqbo4.Document.AI/readme.mdqbo4.Document.AsposeCells/CellsService.csExtensions/RouteBuilderExtensions.csqbo4.Document.Aspose.Bridge/CellsGenerator.csqbo4.Document.Aspose.Bridge/PdfImageGenerator.csqbo4.Document.Parquet.Bridge/ParquetGenerator.csqbo4.Document.Avro.Bridge/AvroGenerator.csattachment/Generators
An AttachmentTemplate renders documents through the IGenerator its AttachmentService names (the Plugin on the template screen). qbo3 shipped its own generators, and qbo4 replaces most of them. Where a qbo4 generator exists, use it. The qbo3 generators listed here are the ones with no qbo4 version yet.
For which generator suits which document, see the Overview. To run a template, call /api/attachment/generate (or /api/attachment/queue/generate for batches), as described in Document Management.
Generators
Section titled “Generators”| Plugin | Version | Data in | Output |
|---|---|---|---|
BridgeGenerator |
qbo4 | the template Method’s result: Summary XML, a DataSet or an IDataReader |
depends on the merge |
CellsGenerator |
qbo4 | Summary XML, plus qbo3 methods named in the workbook |
Excel, CSV, PDF |
ZipGeneratorCore |
qbo4 | a query listing the documents | ZIP, split into parts when large |
ParquetGenerator |
qbo4 | a DataSet or IDataReader |
one Parquet file per result set, plus a JSON manifest |
AvroGenerator |
qbo4 | a DataSet or IDataReader (not XML) |
Avro |
PdfImageGenerator |
qbo4 | the PDF the attachment is generated against, or a query returning AttachmentIDs |
one attachment per image |
DelimitedGenerator |
qbo3 | a DataSet |
one delimited file per table |
FixedWidthGenerator |
qbo3 | a DataSet |
one fixed-width file per table |
XhtmlGenerator |
qbo3 | parameters | HTML, through an XSLT Transform |
PdfMerge, PdfEdit |
qbo3 (ABCpdf) | existing PDFs |
qbo3 generators qbo4 replaces
Section titled “qbo3 generators qbo4 replaces”Don’t configure these for new templates, and move existing templates when they are next changed.
| qbo3 Plugin | Use instead | Plan for |
|---|---|---|
Aspose-Xml |
BridgeGenerator, Service=AsposeWords |
Same Summary XML and merge fields |
AsposeWord |
BridgeGenerator, Service=AsposeWords |
No [[Column]] text substitution: convert those placeholders to MERGEFIELDs |
AsposeWord-SingleDocument |
BridgeGenerator, Service=AsposeWords, MergeEach=<row element> |
One document per row, merged from that row only; qbo3 also offered the other result sets as regions |
PdfForm (iText) |
BridgeGenerator with a fillable PDF as the Transform (AsposePdf) |
Radio buttons and push buttons aren’t filled |
Aspose-Excel, ExcelGenerator (OpenXml) |
CellsGenerator |
Workbooks need named ranges with ?= comments |
ZipGenerator |
ZipGeneratorCore |
A drop-in replacement: same parameters, flat memory use |
PdfSplit (ABCpdf) |
the PdfSplitByPage, PdfSplitByOutline, PdfSplitBySize and PdfSplitBySemantics attachment operations |
An attachment operation, not a Plugin: call it from a workflow step or batch |
Merges run by BridgeGenerator
Section titled “Merges run by BridgeGenerator”BridgeGenerator hands the template and data to IMergeService, which runs one IMerge:
Service= |
Package | Template (Transform) |
Output |
|---|---|---|---|
AsposeWords |
qbo4.Document.AsposeWords |
Word | PDF, Word, HTML, text, TIFF |
AsposeCells |
qbo4.Document.AsposeCells |
Excel | Excel, CSV, PDF |
AsposePdf |
qbo4.Document.AsposePDF |
fillable PDF | PDF, Word, HTML, text, TIFF |
Archive / DotNetZip |
qbo4.Document.Archive / qbo4.Document.DotNetZip |
none | ZIP |
AiMerge |
qbo4.Document.AI |
a prompt (text, Markdown, HTML), or the template’s Description |
PDF, Word, Excel |
How the merge is chosen (MergeService):
Service=<Name>picks the merge by name (case-insensitive). An unknown name fails.- Otherwise, with a
Transform, the first merge whose input types include theTransform’s mimetype and whose output types include the requested mimetype. - Otherwise, the first merge that can produce the requested mimetype.
The output mimetype is the MimeType parameter, else the template’s MimeType, else the configured default. Set Service=AiMerge explicitly for a prompt-only template: with no Transform, rule 3 would pick whichever merge first claims the output type.
Parameters
Section titled “Parameters”Parameters merge in order of precedence, lowest first: the template’s GeneratorParameters (a query string), the generator’s own Parameters, then the call’s parameters.
| Parameter | Effect |
|---|---|
Service |
Names the IMerge to run (see above). |
MimeType |
Overrides the output mimetype. |
MergeEach |
Fans out on an element (for example MergeEach=PaymentItem): one document per element, each merged from that element only, saved as siblings of the generated attachment. Fails if no such element exists. |
Context |
Comma-separated extra content for AiMerge: Parent, Transform, Documents (found by the template’s Method), Method (the method’s result). Opt-in. |
Service=AsposeWords&MimeType=application/pdf&MergeEach=PaymentItemMerge details
Section titled “Merge details”AsposeWords
Section titled “AsposeWords”MERGEFIELD names resolve as XPath against the record’s Summary XML. An invalid XPath fails the whole document; an XPath with no match renders blank. Values arrive as strings, so Word’s \# and \@ switches don’t reformat them. { MERGEFIELD Image:SignatureID } loads the attachment whose ID the field resolves to.
A region between { MERGEFIELD TableStart:PaymentItem } and { MERGEFIELD TableEnd:PaymentItem } repeats once per item, and regions nest:
| Data | A region named PaymentItem repeats per |
|---|---|
qbo3 XML (Summary) |
PaymentItem element (Payment also matches) |
| JSON | item of the first array named PaymentItem, at any depth |
DataSet or IDataReader |
row of the result set whose first column is PaymentID, or whose table is named PaymentItem |
Use the element’s full name, Item included, so the template also works under qbo3. A field inside a region reads the current item first, then the whole document. A region whose list is missing is filled once from the document, so a record with no items leaves one blank row.
AsposeCells and CellsGenerator
Section titled “AsposeCells and CellsGenerator”A named range whose comment starts with ?= is filled with data:
?={FirstName}substitutes a value from the record.?=Contact/Search?Status=Activeruns a qbo3 method ({class}/{operation}?{parameters}) and imports its rows. The class must be in qbo3’sObjectConfiguration;{tokens}in the parameters are substituted from the record first.
In a multi-column range, the first row names the data columns to import (an optional range named {RangeName}Map translates headers to column names). Columns whose header matches no data column keep the formula in the row below, which is copied to every imported row. A cell formatted as a number or date receives a number or date, not text.
A range whose comment starts with = is an output. Generators ignore it: extraction runs only through CellsService and the calculate/{provider}/{path} POST route (UseAsposeCellsRoutes), which fill a copy of the workbook per item and return the = ranges as values.
AsposePdf
Section titled “AsposePdf”Each AcroForm field is matched by its partial name against the data. Text and other value fields are set; ButtonField, RadioButtonField and RadioButtonOptionField are skipped; a field with no matching value is set to null (cleared). Password (and optionally OwnerPassword) encrypts the output with AES-256.
Archive and DotNetZip
Section titled “Archive and DotNetZip”Each item names an existing document by Uri. Entries are named after each document’s file name, so duplicates collide. Password applies traditional ZipCrypto encryption. Archive (SharpZipLib) streams entries, so memory stays flat; DotNetZip is the older implementation of the same contract.
AiMerge
Section titled “AiMerge”AiMerge asks a model to produce a file rather than filling one in. Its input types are text (text/plain, text/markdown, text/html), so a Word or Excel Transform never routes to it by mimetype; from qbo3, always set Service=AiMerge.
What the model receives, in one message:
| Content | Source |
|---|---|
| Instructions | The template’s Description, which replaces the configured AiMergeOptions.Instructions, followed by “Produce a {mimetype} file.” Not substituted per item, so a prompt can contain literal {braces}. |
| Prompt document | A text Transform, if any, substituted against the item with IMatcherService. |
| The item | The Method’s result, as XML text (XDocumentContentBuilder, XmlReaderContentBuilder). |
| Context | What Context= names: Parent, Transform, Documents, Method. Documents go as DocumentContent, which a provider can read by reference instead of re-uploading. |
| Samples | Attachments bound to the template (Object=AttachmentTemplate), sent as a corpus of examples. The Transform is not a sample. |
Content comes from qbo4.AI’s IContentBuilderRegistry. An object with no matching builder contributes nothing, silently: when a model says it couldn’t see something you sent, check that first.
How a file comes back. The model writes the document by running code in the provider’s hosted code interpreter (UseCodeInterpreter, on by default), and ArtifactStoringChatClient saves what it returns. Drafting from a source document often takes several turns, so AiMerge continues the conversation (up to MaxTurns, default 4) until the document arrives:
- The prompt ends with
ManifestInstruction, asking the model to finish with a JSON manifest of the files it delivered. The manifest separates the document from working files (page images, charts, scripts), which are deleted. - With no file, it sends
ContinueInstruction; with files of the wrong type,WrongTypeInstruction. - If no file arrives, the merge throws with the model’s own reply in the message, which usually explains why (a refusal, a question, a missing input).
Each delivered document’s Metadata carries the manifest’s ManifestName and Description. When a merge returns several documents, the first becomes the generated attachment and the rest are saved as siblings.
Configuration. Section Documents:AiMerge; its presence registers the merge. Agent (required) names the qbo4.AI agent, configured under GenerativeAI:Agents. Any of Instructions, Agent, MaxTurns, ContinueInstruction, DestinationRoot, UseCodeInterpreter and ContentBuilders can also be set per template in GeneratorParameters.
| Provider | Notes |
|---|---|
| OpenAI | Uses the Responses API; conversations continue server-side, keeping the interpreter’s files. |
| Gemini | Use Vertex AI: the API-key path rejects an inline PDF once code execution is on. |
| Anthropic | Works; the slowest of the three. |
Model output is not deterministic: the same template can succeed on one run and fail on the next. Allow for retries, and keep a human review step after every draft.
ZipGeneratorCore
Section titled “ZipGeneratorCore”| Parameter | Effect |
|---|---|
Password |
Protects the package. |
OnError |
By default an unreadable document is left out, its Status set to Error and the failure logged against it. Stop does the same, then fails the package; Ignore leaves it out silently. |
Link |
Links the package to its contents. |
MaxFileSize |
Bytes per part before rolling over into a new part (default 4 GB). |
ParquetGenerator and AvroGenerator
Section titled “ParquetGenerator and AvroGenerator”ParquetGenerator writes one Parquet file per result set and a JSON manifest naming each file and its row count; the Manifest parameters set the manifest’s file name and node names. AvroGenerator accepts a DataSet or IDataReader; XML input is not implemented.
PdfImageGenerator
Section titled “PdfImageGenerator”Without a template Method, extracts images from the PDF the attachment is generated against. With one, extracts from every PDF whose AttachmentID the query returns. Every image is extracted, including logos.
qbo3-only generators
Section titled “qbo3-only generators”DelimitedGeneratorandFixedWidthGeneratorwrite one file per table from BCP-style settings inGeneratorParameters(row terminator, column headers, header and row prefixes, beginning and end-of-file records, file name).XhtmlGeneratorrenders HTML from an XSLTTransformand the call’s parameters. For new HTML, a Word template throughBridgeGeneratorwith HTML output is easier to maintain.PdfMerge(ABCpdf) combines existing PDFs, optionally adding page numbers and a footer; qbo4 has no equivalent yet.PdfEditremoves text between start and end markers in existing PDFs; qbo4’sRedactoperation is a different tool, which uses an AI agent to find personal and sensitive content.