Codeunit 9987 "Word Template"
System Application · System.Integration.Word
Across versions
- BC23-25present
- BC261 procedures removed
- BC271 procedures added
- BC28-30unchanged
Neighbourhood 8 connected objects and pages
System Application · System.Integration.Word · BC23-30 · source at ea08af5e · facts from BC29
Properties
| Property | Value |
|---|---|
| Access | Public |
Events published
OnGetCustomFieldNames(var WordTemplateCustomField: Codeunit "Word Template Custom Field")(integration): Event to get custom field names for the word template based on the table id. Make sure to also subscribe to GetCustomRecordValues in order to provide the values for these fields.- subscribers: Codeunit 5070 “Custom Word Template Fields” OnGetCustomFieldNames
OnGetCustomRecordValues(var WordTemplateFieldValue: Codeunit "Word Template Field Value")(integration): Event to add values for the custom fields specified through GetCustomFieldNames. In order to add a value for a field, it MUST be registered through the event GetCustomFieldNames.- subscribers: Codeunit 5070 “Custom Word Template Fields” OnGetCustomRecordValues
Procedures
DownloadTemplate(): Downloads the set template.DownloadDocument(): Downloads the resulting document.GetTemplate(var InStream: InStream): Gets an InStream for the template.GetDocument(var DocumentInStream: InStream): Gets an InStream for the resulting document.GetMergeFields(var Value: List of [Text])+ BC27: Gets the merge fields used in the template.GetDocumentSize(): Integer: Gets size for the resulting document.Create(): Creates a template with the fields of a table. The table is selected by the user via a popup window.Create(TableId: Integer): Creates a template with the fields of the given table.Create(TableId: Integer; RelatedTableIds: List of [Integer]; RelatedTableCodes: List of [Code[5]]): Creates a template with the fields from a selected table and a list of related table IDs.Create(MergeFields: List of [Text]): Creates a template with given merge fields.Load(WordTemplateCode: Code[30]): Loads the template to be used for merging.Load(WordTemplateStream: InStream): Loads the template to be used for merging.Load(WordTemplateStream: InStream; WordTemplateCode: Code[30]): Loads the template to be used for merging from the stream and additional related fields from the WordTemplateCode which is used as the base.Merge(Data: Dictionary of [Text, Text]): Performs mail merge on set template and given data. Output document is of type .docx.Merge(Data: Dictionary of [Text, Text]; SaveFormat: Enum "Word Templates Save Format"): Performs mail merge on set template and given data. Output document type is of specified save format.Merge(Data: Dictionary of [Text, Text]; SaveFormat: Enum "Word Templates Save Format"; EditDoc: Boolean): Performs mail merge on set template and given data. Output document type is of specified save format.Merge(Data: Dictionary of [Text, Text]; SaveFormat: Enum "Word Templates Save Format"; EditDoc: Boolean; DocSharingConflictBehavior: Enum "Doc. Sharing Conflict Behavior"): Performs mail merge on set template and given data. Output document type is of specified save format.Merge(SplitDocument: Boolean): Performs mail merge on set template and data taken from the Record associated with the Document. Output document is of type .docx.Merge(SplitDocument: Boolean; SaveFormat: Enum "Word Templates Save Format"): Performs mail merge on set template and data taken from the Record associated with the Document. Output document type is of specified save format.Merge(RecordVariant: Variant; SplitDocument: Boolean): Performs mail merge on set template and data taken from the given Record. Output document is of type .docx.Merge(RecordVariant: Variant; SplitDocument: Boolean; SaveFormat: Enum "Word Templates Save Format"): Performs mail merge on set template and data taken from the given Record. Output document type is of specified save format.Merge(RecordVariant: Variant; SplitDocument: Boolean; SaveFormat: Enum "Word Templates Save Format"; EditDoc: Boolean): Performs mail merge on set template and data taken from the given Record. Output document type is of specified save format.Merge(RecordVariant: Variant; SplitDocument: Boolean; SaveFormat: Enum "Word Templates Save Format"; EditDoc: Boolean; DocSharingConflictBehavior: Enum "Doc. Sharing Conflict Behavior"): Performs mail merge on set template and data taken from the given Record. Output document type is of specified save format.AddTable(TableID: Integer): Add a table to the list of available tables for Word templates.GetTableId(): Integer: Get the table ID for this Template.AddRelatedTable(WordTemplateCode: Code[30]; RelatedCode: Code[5]; TableId: Integer; RelatedTableId: Integer; FieldNo: Integer): Boolean: Add related table.SetDefaultFields(WordTemplateCode: Code[30]; TableId: Integer): Set the default fields for the table.SetExcludedFields(WordTemplateCode: Code[30]; TableId: Integer; ExcludeFieldNames: List of [Text[30]]): Set the fields to be excluded from the word template.GetExcludedFields(WordTemplateCode: Code[30]; TableId: Integer): List of [Text[30]]: Get the fields to be excluded from the word template.GetCustomTableFields(TableId: Integer): List of [Text[30]]: Get a list of all current custom table fields for a given table.GetSupportedTableFields(TableId: Integer): List of [Text[30]]: Get a list of all supported table fields. This list does not include custom fields.IsFieldSupported(Field: Record Field): Boolean: Determine whether a field is supported for Word Templates.RemoveTable(WordTemplateCode: Code[30]; TableId: Integer): Boolean: Remove a related or unrelated table. An error is thrown if the table has any children, these must be removed first.GetChildren(WordTemplateCode: Code[30]; TableId: Integer): List of [Integer]: Get all tables in this template which has a relation to the given table.
Calls
From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an Object::"Name" argument. Interface dispatch and calls through events are not counted, so the list is not complete.
- Codeunit 9988 “Word Template Impl.” (15 calls:
AddRelatedTable → AddRelatedTable,AddTable → AddTable,AddUnrelatedTable → AddUnrelatedTable, …) - Codeunit 9989 “Word Template Field Selection” (6 calls:
GetCustomTableFields → GetCustomTableFields,GetExcludedFields → GetExcludedFields,GetSupportedTableFields → GetSupportedTableFields, …)
Called by
- Codeunit 5069 “Word Template Interactions” (6 calls:
ExecuteMerge → GetDocument,ExecuteMerge → Load,ExecuteMerge → Merge, …) - Page 9996 “Word Template Selection Wizard” (5 calls:
MergeTemplate → GetDocument,MergeTemplate → Load,MergeTemplate → Merge, …) - Codeunit 9988 “Word Template Impl.” (3 calls:
AddCustomValuesToDataTable → OnGetCustomRecordValues,GetCustomMergeFields → OnGetCustomFieldNames,GetCustomTableColumns → OnGetCustomFieldNames) - Codeunit 9989 “Word Template Field Selection” (3 calls:
CalculateNoSelectedFields → OnGetCustomFieldNames,GetAllTableFields → OnGetCustomFieldNames,GetCustomTableFields → OnGetCustomFieldNames) - Table 5077 “Segment Line” (3 calls:
LoadTemplateAttachment → Load,MergeTemplate → GetDocument,MergeTemplate → Merge) - Page 9999 “Word Template To Text Wizard” (2 calls:
GetDocumentAsText → GetDocument,GetDocumentSize → GetDocumentSize) - Codeunit 104000 “Upgrade - BaseApp” (1 call:
UpgradeWordTemplateTables → AddTable)
Ask your agent
Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: bcatlas_resolve_node(object_type: "codeunit", object_name: "Word Template"), then bcatlas_get_procedure_body or bcatlas_get_neighbors on the returned id.