HarePoint was asked whether it is possible to create an invoice with a variable number of rows in a table. So we have added new workflow action, Add New Row into Word Document, to HarePoint Workflow Extensions.
This new action can add a copy of the last row in the Repeating Section Content Control. Then this new row can be edited with the Update Word Document action. Note that Repeating Section Content Control was introduced in Microsoft Word 2013.
This article describes how to create an invoice with a variable number of items. And we will use the Update Word Document and the new Add New Row into Word Document actions from HarePoint Workflow Extensions for SharePoint:
Component name and type | Workflow components used | |
SharePoint Workflow | HarePoint Workflow Extensions | |
Add New Row into Word Document (Action) | ||
Update Word Document (Action) | ||
Set Workflow Variable (Action) |
We will use an Invoice created from a Microsoft Word template.
First, remove empty rows and leave only one. Select it and click Repeating Section Content Control in the Developer menu.
The Plus button will appear on the right to add new rows to the table. We do not have to click it because our SharePoint workflow will do all the required actions for us.
Set up Title and Tag in the Content Control Properties.
Next add a Plain Text Content Control to each cell and give them unique names. They will hold the required data. The table should look like this:
Let’s start creating the Workflow that will fill the table.
Use the Update Word Document action to set values of each content controls. Note that for the content controls from the repeating section you need to choose “last occurrence (repeating content control)” option in the workflow action. For regular content controls (outside the repeating section), use “all occurrences” option. Make sure you have the latest version of HarePoint Workflow Extensions for these options to be available.
Save, publish and test the Workflow to update the table in the invoice in the Word Document:
You can also watch the whole process of creating such a workflow in this video:
Learn more about HarePoint Workflow Extensions and over 350 new actions to automate any business process without programming.