Skip to main content

Working with Word Automation

Word Features

IntelliBuddies Word Automation activities utilize specific Word features to support easier automation. Hence, designers need to understand the following Microsoft Office Word features:

Bookmarks

A bookmark inside a word document represents a specific location inside that document. You can consider a bookmark similar to the bookmark you might place in a book. Automating word document creation starts from creating a word document template to be used for automation. We will utilize bookmarks to identify a specific location inside the word document to insert a text, table, or picture.

For more information on bookmarks, please refer: MS Word Bookmarks

Creating Bookmarks inside Word document

Alternative Text to Pictures

Since our buddies can read or analyze text easier than graphic content, we utilize Alternative Text Properties for pictures to identify and replace them with dynamic picture content during automation.

For more information on alternative text property, please refer: Alternative Text Properties

Adding alternative text to pictures...

Sample Word Automation

In this tutorial, we will show you how you can utilize the above-explained word features along with IntelliBuddies activities to automate word document creation.

The sample process provided here automates the generation of 15-CA and 15-CB income tax forms used by organizations to file their foreign remittances.

Step-1: Download the process

Download the process from here:

15CA-Generation-Process

Step-2: Extract the process to a local folder

Double click on the downloaded zip file and extract it to one of the local file system folders

Step-3: Run Process Designer and open the extracted process

Start IntelliBuddies Process Designer and load the extracted process

Step-4: Understanding process inputs

The process is fed input through various excel files listed below:

  • Configuration: This excel sheet provides all the information about the Organization which is filing foreign remittances
  • Customers: This excel sheet provides all the information about the customers of this Organization
  • CurrencyExchange: This excel sheet provides the currency exchange rates used for foreign remittance tax calculation
  • Invoices: This excel sheet provides the details of the invoices raised by customers to this Organization

Step-5: Word document templates

The process automates the generation of both 15CA and 15CB tax forms. Further, the 15CA form is divided into four different parts. A particular part is utilized based on specific criteria. Hence, the sample includes five(5) word document templates for automation.

  • 15CA-Part-A-Template
  • 15CA-Part-B-Template
  • 15CA-Part-C-Template
  • 15CA-Part-D-Template
  • 15CB-Template

Step-6: Process Architecture

The process has been designed keeping reusable workflows in mind. Hence, the process contains the following workflows:

  • Main: The main workflow reads all the inputs from excel files and stores them inside data tables. It will then processes invoices read from the invoices excel sheet in a loop. For each invoice, based on the invoice amount criteria, it invokes the appropriate workflow.
  • 15CA-Part-A-Generator: This workflow automates the generation of 15CA Part-C form generation.
    • Utilizes 15CA-Part-A-Template as part of Word Context activity
    • Utilizes Replace Bookmarks activity to fill in appropriate dynamic content
    • Utilizes Save As activity to save the filled word template as a PDF file into output folder
  • 15CB-Generator: This workflow automates generation of 15CB form generation. The activities used in this workflow is similar to the one used in 15CA-Part-A-Generator workflow except that the word context here is set to 15CB-Template

Step-7: Process Output

The process outputs the generated documents in PDF format into your desktop folder.

  • creates ForeignRemittanceDemo/OUTPUT folder under your desktop
  • creates a folder per customer under the above OUTPUT folder
  • dumps all the documents (*.pdf) generated for that customer inside this folder

Step-8: Exercise - 15CA-Part-A-Generator

The sample process attached here implements the generation of the 15CA-Part-C portion of the form. Let us walk through to add a new workflow to automate the generation of the 15CA-Part-A form.

  • Step-A: In Process Designer, go to the Project Explorer panel. Right-click on the root of the tree and Add a new Sequence. Provide a name ITR-15CA-Part-A-Generator to this Sequence and click on Create. This will create a new workflow with the given name and open that workflow in the Designer Panel.
  • Step-B: Go to the Arguments panel and create all the input and output arguments. This workflow would take the same input and output arguments as the ITR-15CA-Part-C-Generator workflow. Hence, refer to an existing workflow and create the argument for this new workflow.
  • Step-C: Search for Word Context activity in the Activities panel. Drag and drop that activity into the new workflow. Set both Document Path and Design Time Template properties to "ITR-15CA-Part-A-Template.docx"
  • Step-D: Search for Replace Bookmarks activity in the Activities Panel. Drag and drop that activity under the Word Context activity.
  • Step-E: Select the existing bookmarks and replace them with the dynamic text.
  • Step-F: Search for Save As activity in the Activities Panel. Drag and drop that activity below the previous activity added inside Word Context. Select the File Format property to PDF. Specify the output File Name and the Output Directory to save the output file.
  • Step-G: Save the workflow by clicking on Save from the menu
  • Step-H: Open the Main workflow from the Project Explorer panel
  • Step-I: Search for Invoke Workflow activity in the Activities Panel. Drag and drop that activity under the block where Part-A needs to be invoked.
  • Step-J: Select the workflow and map the arguments
  • Step-K: Click on Save All to save all the workflows as part of this process.
  • Step-L: Insert a new record inside Invoices excel file with invoice amount less than 5L INR.
  • Step-M: Run the process and ensure that 15CA-Part-A gets generated properly.

Note: Follow the same steps to design the workflows for the remaining parts of the 15CA form.

Note: If you have a picture inside a word document template with Alternative Text property, you can replace it using Replace Picture activity as depicted below:

Summary

Overall, by the end of this exercise, you should have learned how to utilize the following automation activities:

  • Word Automation Activities
  • Excel Automation Activities
  • Process Designing with modular workflows
  • Invoking workflows bypassing input arguments and processing output arguments