Embedded Bookmarks in a magic5 Word Document report
Embedded bookmarks enable Word documents to:
- include additional magic5 templates
- include other Word templates
Special instructions need to be put into
- The main Word templates, and
- the Word template Additional Settings in magic5
Simple version
The information below looks very complicated and difficult but the basic steps are:
- request a button from magic5 support
- create the main and sub word documents, making sure any table row documents match and adding bookmarks where they need to go.
- add anything to the Word template list items if required, bearing in mind that identifying the Word template for the bookmark is the only setting that is necessary as defaults exist for
- using only the selected reports
- appending sub-documents to the end
- omitting the first line in a table
- create the embedded document by selecting the reports to include and clicking on the button in step 1
Embedded bookmarks in Word templates
- Each document to be embedded needs to be created and bookmarked in the main document using the syntax Embedded[document name]
- The main document needs to be in the same format as the embedded document (eg landscape or portrait) or formatting problems may occur.
- Each report selected can appear as:
- a complete document, such as the Certificate shown in the example, where the whole document will be repeated for each report selected, or
- a line within a table, such as the Inspection shown in the example, where a new line is inserted for each report selected.
- in this case it is important that the number of columns in the main document matches the number of columns in the embedded document
Word template Additional Settings
These settings are set up in the main Word template.
- Settings to decide which reports will populate the embedded documents:
- [bookmark name]_Select will default to External which means that only selected reports will be used
-
[bookmark name]_Select can also be set to a string indicating that the same location, customer and/or template as the main document are used.
- the location, customer and/or template can also be set to a specific id (only really relevant for template)
for example, to use a specific report for the selected customer and locationEmbeddedInspection_Select=Location;Customer;templateId:17608
EmbeddedCertificate_Select=Location;Customer;templateId:17372
- the location, customer and/or template can also be set to a specific id (only really relevant for template)
-
[bookmark name]_condition can also be used to create conditional inclusion
- any condition that is used for Display Conditions on the server can be used here
- for example, to use a specific report for the selected customer and location
EmbeddedInspection_condition=sV;%TEMPLATE_ID%;equals;17608
EmbeddedCertificate_condition=sV;%TEMPLATE_ID%;equals;17372
- Settings to decide how reports will be embedded:
-
[bookmark name]_Type can be equal to
- AppendSections which is the default and adds a new section at the end of the document
- TableRow which inserts a row into the table (in which the bookmark must be positioned) and which must match each other
- PostBookmark which inserts the document after the bookmark.
- for example
EmbeddedInspection_Type=TableRow
EmbeddedCertificate_Type=PostBookmark
-
[bookmark name]_Type can be equal to
- Sort the order of the embedded forms using [bookmark name]_Sort and it can be equal to any standard variable such as %DATE%, %CUSTOMER% or %@[unique name].
- variables can be strung together for a hierarchical sort such as %CUSTOMER% %LOCATION% %DATE%
- for example
- EmbeddedInspection_Sort=%TEMPLATE% %CUSTOMER% %DATE%
- EmbeddedCertificate_Sort=%DATE%
- Settings to decide which template with populate each embedded document:
- [bookmark name]_EmbeddedWordTemplateId contains the id of the Word template list item (found in Setup/Maintenance->Lists->Word Templates List entries at the right-hand side)
-
EmbeddedInspection_EmbeddedWordTemplateId=321886
EmbeddedCertificate_EmbeddedWordTemplateId=321887
- Other parameters include
- [bookmark name]_SingleOnly =True ensures that only the first embedded document is generated
- [bookmark name]_IgnoreMaster =True ensures that the main form isn't included in the list of embedded ones
-
[bookmark name]_OmitRows tells magic5 how many rows to ignore in a TableRow embedded type.
- defaults to 1 as it assumes there is a header
- for example
EmbeddedInspectionSchedule_OmitRows=0
- Some variables used are
- EmbeddedTitle[bookmark name] is a bookmark that will remove the bookmark contents if there no instances of the bookmark name
- EmbeddedNo which is the sequence number of the embedded document starting from 0
- EmbeddedNoHuman which is the sequence number of the embedded document starting from 1
- CustomVariable which is the value of the setting [bookmark name]_VarN where N is the EmbeddedNo
- It is also possible to use formula using these variables, for example
ShowMaintenance=sV;%!EmbeddedNo%;notequals;0
ShowEmbedded=%!EmbeddedNo%