Version: 4.2.1 +
In this exercise we will merge a table into a Word-document.
- The Futurama Editor must be installed.
- Completing the tutorial Generating Documents first, is recommended.
- Completing the exercise Tax Rate (Medium) first, is recommended.
This assignment is a continuation of the previous assignment Tax Rate (Medium).
You can download the basis for this exercise (the end-result of this previous exercise, and the extra external files needed), by clicking here. These files are necessary for completing the assigment. Unzip and place the files in one develop-folder.
In this exercise we will merge a table into a Word-document. We want to add a table of tax rates to the document, to give us more clarification.
- Add the information below to the document, by merging it into the document from Futurama.
Rate of 10% Factor 0.9
Rate of 20% Factor 0.8
Rate of 30% Factor 0.7
- Create PDF-documents instead of Word-documents.
Take the following steps to do so:
- Create a UserVariable 'Rates' of type Double within the Node Tax Rate.
- Create an XmlBuilder 'Loop' within the existing XmlBuilder 'Merge' and configure it as follows:
- RepeatData: refer to the 'Tax Rates' Table
- RepeatTarget: refer to the UserVariable 'Rates'
- Create another XmlBuilder 'Data' within the 'Loop' XmlBuilder and fill it as follows:
- Create a reference 'Rates' to the UserVariable 'Rates'
- Create a formula 'Factor' that calculates the Net-factor based on the 'Rates' UserVariable
- Verify by evaluating the 'Merge' XmlBuilder that the XML-data is now extended with three Data-entries, which hold the different tax rates and factors.
- Open de Word document 'Letter.doc'. This document should be extended with the table information:
- At the top of the document, create a Mergefield named 'TableStart:Merge'
- At the bottom of the document (below the other mergefields), create a Mergefield named 'TableEnd:Merge'
On an appropriate place within the content of the document, we now will place the Table:
- Create a Mergefield named 'TableStart:Data'
- Create one line of content that holds the given text-line, and include the Mergefields 'Rates' and 'Factor'
- Create a Mergefield named 'TableEnd:Data'
- Configure your DocConverter:
- Set UseNestedData on 'True' to enable the table-construction
- Set DocumentFormat on 'PDF' to generate PFD's instead of Word documents.
- Verify if your construction works by executing the Action from within the Editor or by clicking your batch-file.
- Make sure you change the ResultFileName as well. It should have a .pdf-extension instead of .doc.
- If executing the Action doesn't work:
- Make sure you have writer's permission on the output-folder.
- Make sure you have closed the Letter.doc file before executing. The DocConverter won't work when your Word-file is still open!
You can download our solution for this assignment by clicking the image at the right. (Futurama 126.96.36.199)
Please note that you can very well have a different solution that is just as good as ours.
If you want some more practise on this subject, you could try the extra exercises below.
We won't provide a solution for these variations, just consider them as a way to further experiment with Futurama.