Creating a Word Template for use with Invantive Composition
Articles Blog

Creating a Word Template for use with Invantive Composition

October 17, 2019

Hello and welcome to this video on the use of Invantive Composition for publishing and creating Word templates. Today, I’m going to show you how you can create a template for you and your end users. We’re going to use data from an existing database to put into a Word template. This template can be published by your end users. There is a video on this channel that explains how you can do this. We’ll use a pre-defined description of your data in your database, application, or web service. This is a so-called “Model” for Invantive Composition. A model defines the structure of the data created in the database. You can also automatically create a model from your metadata in tools like: PowerCenter, Data Dictionary, Oracle Designer or Invantive Studio. Let’s start by opening an empty Word document with a provided model. When Word starts, you can see it loads the add-in “Invantive Composition for Word”. When it is done, it’ll check if an update is available. Invantive Composition for Word will ask you to connect to a data source. We’ll connect to the “Demo MySQL” environment. It is automatically available to you when you’re running a demo version. Demo MySQL always uses a predefined username and password which have already been filled in for you. Click “Log in” to connect to the data source. OK. Now that we are connected to the data source, “Invantive Composition” ribbons appear in Word. The video on publishing a document shows you how end users can use the Invantive Composition ribbon to publish documents. You can see the button for publishing here on the left hand side. Depending upon your configuration you can also have the option to open a template from an archive, such as SharePoint, Saros or IBM ECM. Invantive Composition can also load templates from our project management solution Invantive Vision. Finished documents can be archived directly from within Microsoft Word to any Document Management System. In this case, our template doesn’t contain any content to publish, but it’s still possible to publish it. Let’s try that. We’ll get an empty document if we accept the default parameter values. OK, the result of the publication is indeed an empty Word document. “Ctrl-W” will close the document. Let’s do that. Now, I’m going to build a real template to merge data into Microsoft Word. To build a real template you’ll need to use the ribbon “Modeler”. It’s to the right of the Invantive Composition ribbon. All buttons in “Modeler” are grayed out by default. First switch to “Design Mode” with the “Design Mode” button. If a model is password protected, this is when you would enter the password. This model has not been protected, so you can enable buttons just by clicking “Design Mode”. This model was created using a data dictionary or a metadata tool. Another video explains how you can build a model like this. One thing, you can use central models to easily distribute models globally. That makes distribution easy, even with 500 templates or more. You can export your current model using the buttons located here on the top. We aren’t going to make changes to the model. Just close this window. This model describes a data model with questions and answers for students. Let’s start by making a list using the questions in the database. A template of Invantive Composition contains a number of instructions which are XML-like constructs in your Word document. You can enter it by hand. But the easy way to do it, is to use “Building Blocks”. The “Building Blocks” are based upon the definitions in your model and are located right here. Let us define a list of questions. That requires a “repeating block” of questions. I insert that at the top of the document. As you can see, two instructions are inserted into the Word document. There is an instruction for the start and end of the repeating block. All content between those two instructions is repeated for every row that meets the criteria of the associated database or web service query. The code “q” is a short reference to a block in the model. The block defines the SQL query. It is also possible to enter free-text SQL statements within the instructions, but for brevity it is better to use the predefined building blocks. Between the “begin” and ”end” instructions we enter the text to be repeated, for example: “Question”. OK. Now we want to insert the actual question. The easiest way again is to use the “Building Blocks” button to insert the question. This is a list of predefined fields. You can just select the current value of the question. But you can also insert all kinds of variants by just selecting them. OK. The Word document now contains an “Expression”. It tells the Invantive Composition to insert here the value of the field “Question”. The “Expression” can also contain plain text. For example: “Question is”. But I’m going to remove this element. OK, that’s all! The template is now finished. To publish the template you need to select the “Publish” button, but it is disabled. It is disabled because Composition is still in “Design Mode”. First we have to leave “Design Mode”. OK. All these design buttons are now disabled and we can use the “Publish” button. OK, now push “Publish” and accept the default values of the parameters. And now a new Word document is created which combines the template and the data from the data source. You can see it has a header, called “Question” and then the question from the database. That sequence repeats itself. OK. I’m going to close this document. And now we can start adding some extra features to the template. For instance, I would like the question to be bolded. So I bold the text here. I also want to include an answer. Now I want to insert the answer from the database, so I do that by clicking “Design Mode”, “Building Block”, “Question”, “Answer”, and “Current Value”. OK, it shows up. Go ahead and leave “Design Mode” and again publish the template as a new Word document. You can see that the layout in the template is applied to the published document. If you bolded words, made italics, inserted a photo, applied a style: it’ll all be retained in the document when it’s published. This works for any sort of formatting done. The additional field “Answer” is included in the resulting document and repeated. OK. Close this document. Now we are going to get a little more complex. For instance, I want a guide for the teacher that has questions and answers. Also I want to have a student’s guide with only the questions. I need the list to repeat itself, once with only questions and once with the questions and the answers. Using the “Building Blocks” in “Design Mode” you can create more repeating blocks. But of course you can also use “Copy and Paste” to copy the instructions. So you can use “Building Blocks” to easily enter instructions or use “Copy and Paste” to create a list. This is the student’s part, so I’m going to remove the answer. Let’s label it “Student’s Part”. Down here is the “Teacher’s Part” which I’m also going to label. I’m going to give it a nice heading. OK, we’re done. Leave “Design Mode” and again click “Publish”. Once again, accept the default parameter values. We have a new document consisting of a student’s part with only questions. Followed by a teacher’s part with questions and answers. As you can see it’s very easy to create multiple tables with information from your database in your published document. Let’s go a little bit further and also include a title. Go back to the “Design Mode”. The title won’t come from database but from another data source, namely the model itself. You can include, for instance, the values of the parameters you have used. But you can also include values from the database, the document, the model or the system. For instance, “What is the name of the PC” on which this template was published? In this case I want to use the name of the document. Now the author. The author of the model should also be the author of the published document. And we add a nice page feed to make sure the title has a nice place on the next page. OK. We again go to “Publish”. Accept the values. And the document is published. Now it has used “Questions and Answers” for a title. This is a property of the model. The author of the model is copied into the output. And when I scroll down you can see the questions again. OK, that was a simple example of building templates for use with Invantive Composition and your data source. There are many more features available, but hopefully you have enjoyed learning how to use the basics. In another video you can learn how to build your own model. If you have any questions, please go to or send an email to [email protected] Thanks for watching!

Leave a Reply

Your email address will not be published. Required fields are marked *