Update Word Document
This activity performs a series of modifications to .doc or .docx files. You can find-and-replace existing text, insert new text, or fill tables using static values or tokens. You can insert rich-text tokens derived from Laserfiche Forms' rich-text fields, preserving formatting and styling from the rich-text fields.
Before inserting text or filling tables, make sure that you've prepared the appropriate merge fields in the Word document. See Preparing a Document with Merge Fields or the Updating a Microsoft Word Document with Laserfiche Workflow white paper for more details.
- Drag it from the Toolbox Pane and drop it in the Designer Pane.
To configure this activity
Select the activity in the Designer Pane to configure the following property boxes in the Properties pane.
-
Activity Name
Once added to a workflow definition, the default name of an activity can be changed. Providing a custom name for an activity helps you remember the role it plays.
To name an activity
- Add an activity to your workflow by dragging it from the Toolbox Pane and dropping it in the Designer Pane.
- Select the activity in the Designer Pane.
- Under Activity Name in the Properties Pane, replace the default name.
Note: Activity names cannot be the same as any other activity name in the workflow, they cannot be the same as the workflow's name, they must be less than 100 characters, they must contain at least one alphanumeric character, they cannot be "Name," and they cannot be the same as the activity's runtime type (which is usually only an issue with custom activities).
-
Activity Description
Use the Activity Description to provide descriptive text to help you remember the role that the activity plays in the workflow. All activities contain a default description that you can modify while constructing your workflow.
To modify an activity description
- Add an activity to your workflow by dragging it from the Toolbox Pane and dropping it in the Designer Pane.
- Select the activity in the Designer Pane.
- Under Activity Description in the Properties Pane, replace the default description.
-
Document to Modify
This property box determines which document will be modified.
To configure File to Attach
- Add the Update Word Document activity to your workflow definition by dragging it from the Toolbox Pane and dropping it in the Designer Pane.
- Select the activity in the Designer Pane.
- Under Document to Modify in the Properties Pane, select and configure one of the following options in the drop-down menu next to Source.
- Workflow Server local disk: Select this option to choose an electronic document saved on the Workflow Server computer.
- Enter the desired electronic document's file path. Alternatively, click the Browse button (ellipsis) to browse for a file on the Workflow Server, or click the Token button (right arrow) to use tokens to specify a file path.
- Server Attachment: Select this option to choose an electronic document attached to the Workflow Server. You can also attach documents to the Workflow Server with this option. These documents will be available to any Workflow Designer on the Workflow Server.
- Use the drop-down menu to select an electronic document that has been attached to the Workflow Server.
- Click the Browse button (ellipsis) to open the Select File dialog box.
- Click OK.
- Activity: Select this option to attach a document created by an activity in your workflow. For example, activities such as Download Electronic Document produce a document file.
- Click the Brows button (ellipsis) to open the Select File dialog box.
- Click the green arrow next to the document file activity to attach
- Click OK.
Note: You must have file browsing enabled in the Workflow Administration Console to browse for a file on the Workflow Server local disk.
Note: If the document you want to attach is not in the drop-down list, you will need to attach the desired document to the Workflow Server. After you attach the desired document to the Workflow Server, the document will appear in the drop-down list.
-
Modifications
Note: A single Update Word Document activity supports no more than 20 table field merges. If you would like to merge additional tables, please add multiple Update Word Document activities to your workflow. For example, you have a Word document with 21 tables in it. After the 20th merge, no additional table field merges are performed by the Update Word Document activity.
- Add the Update Word Document activity to your workflow definition by dragging it from the Toolbox Pane and dropping it in the Designer Pane.
- Select the activity in the Designer Pane.
- Under Modifications in the Properties Pane, click New to open the up the new modification dialog.
-
To Create a Find Replace Modification
- Select Find Replace in the Type dropdown in the dialog.
- In the Find what: text box, type in the value that will be replaced.
- In the Replace with: text box, type in the value that will replace the previous value.
- Optional:Select the checkbox next to Match case to make the find case sensitive.
- Optional:Select the checkbox next to Match whole word to match the whole word.
- Optional:Select the checkbox next to Use regular expressions to find the word using regular expressions.
-
To Create a Simple Field Merge Modification
- Select Simple Field Merge in the Type dropdown in the dialog.
- Under the Field Name column, type in the name of the field to perform the merge on.
- Under the Value column, type in the value that will replace the merge field.
- Under the Type column, select the type of the value.
- Under the Options column, select what the value will be rendered as.
- Default: Choose this if you don't need to insert barcodes, retain formatted rich text from Forms, or convert values into Boolean data. If you are inserting a rich-text token from Forms and you select Default, the inserted text will include any HTML tags related to rich-text formatting, such as
<b>
and<i>
tags. - Checkbox: Choose this if you want to insert Boolean data based on the field value. Field values are case-insensitive.
- By default, all field values except
no
,0
,false
, andoff
will be inserted as “True” in the Word document.no
,0
,false
, andoff
are translated as “False”. - To specify more field values to be translated as the Boolean value of “False”, specify these values in the Custom Properties box. Multiple values should be separated by semicolons. For example, if you also want
never
andn
to be translated as “False”, enter the following in the box:never;n
.
- By default, all field values except
- Barcode: Choose this if you want a barcode to be inserted. You can then further select a Barcode Type in the drop-down menu that appears. If your preferred barcode type is not listed in that menu, specify your preferred type under Custom Properties in the format "Type=BarcodeType". View a full list of supported barcode types.
- Barcodes also support custom properties in format "Name=Value;Name2=Value2", as defined by Aspose. These come from BaseGenerationParameters, BarcodeParameters, and CodeTextParameters and can be used to change properties of the barcode, like its Color.
Note: Workflow only knows about certain data types: String, Enum, Int, Boolean, Float, and Color. If any of the types of BaseGenerationParameters are not one of the types listed (for instance, BaseGenerationParameters/ImageHeight/ is of type "Unit", and not one of the 6 listed), workflow fails to recognize that custom property. If the data type of the property in the 3 classes is one of the types workflow knows about, it will work properly.
- Barcodes also support custom properties in format "Name=Value;Name2=Value2", as defined by Aspose. These come from BaseGenerationParameters, BarcodeParameters, and CodeTextParameters and can be used to change properties of the barcode, like its Color.
- Rich Text: If you're inserting rich text from a rich-text token and you want the rich-text formatting to be preserved, select Rich Text in the Render field as menu. To format the rich text as plain text, see the documentation on form field tokens. If you select Default instead of Rich Text for a rich-text token, formatting tags like
<b>
will appear around the formatted text.
- Default: Choose this if you don't need to insert barcodes, retain formatted rich text from Forms, or convert values into Boolean data. If you are inserting a rich-text token from Forms and you select Default, the inserted text will include any HTML tags related to rich-text formatting, such as
- Repeat for all merge fields that will be used. Alternatively, click Import field names from document... and select a document to grab field names from.
- Optional: Select the checkbox next to Remove empty paragraphs to remove empty paragraphs created by the merge.
- Optional: Select the checkbox next to Remove unused fields to remove fields that weren't specified in the merge.
- Optional: Select the checkbox next to Remove unused regions to remove regions that weren't specified in the merge.
- Optional: Select the checkbox next to Remove containing fields to remove fields that contain other fields.
- Optional: Select the checkbox next to Remove static fields to remove fields that remain the same upon any document changes.
- Optional: Select the checkbox next to Clear mail merge settings to remove existing mail merge settings.
- Optional: Select the checkbox next to Replace non merge fields to merge other types of fields.
-
To Create a Table Field Merge Modification
- Select Table Field Merge in the Type dropdown in the dialog.
- Click Select... under Source Date File to select the activity that will provide values for the table field merge.
- In the Merge Region Name: text box, type the name of the table containing the field names that will be used in the merge.
- Under the Field Name column, type in the name of the field to perform the merge on.
- Under the Value column, use the dropdown to select which column from the data source will provide the values.
- Under the Type column, select the type of the value.
- Under the Options column, select what the value will be rendered as.
- Default: Choose this if you don't need to insert barcodes, retain formatted rich text from Forms, or convert values into Boolean data. If you are inserting a rich-text token from Forms and you select Default, the inserted text will include any HTML tags related to rich-text formatting, such as
<b>
and<i>
tags. - Checkbox: Choose this if you want to insert Boolean data based on the field value. Field values are case-insensitive.
- By default, all field values except
no
,0
,false
, andoff
will be inserted as “True” in the Word document.no
,0
,false
, andoff
are translated as “False”. - To specify more field values to be translated as the Boolean value of “False”, specify these values in the Custom Properties box. Multiple values should be separated by semicolons. For example, if you also want
never
andn
to be translated as “False”, enter the following in the box:never;n
.
- By default, all field values except
- Barcode: Choose this if you want a barcode to be inserted. You can then further select a Barcode Type in the drop-down menu that appears. If your preferred barcode type is not listed in that menu, specify your preferred type under Custom Properties in the format "Type=BarcodeType". View a full list of supported barcode types.
- Rich Text: If you're inserting rich text from a rich-text token and you want the rich-text formatting to be preserved, select Rich Text in the Render field as menu. To format the rich text as plain text, see the documentation on form field tokens. If you select Default instead of Rich Text for a rich-text token, formatting tags like
<b>
will appear around the formatted text.
- Default: Choose this if you don't need to insert barcodes, retain formatted rich text from Forms, or convert values into Boolean data. If you are inserting a rich-text token from Forms and you select Default, the inserted text will include any HTML tags related to rich-text formatting, such as
- Repeat for all merge fields that will be used. Alternatively, click Import field names from document... and select a document to grab field names from.
- Optional: Select the checkbox next to Remove empty paragraphs to remove empty paragraphs created by the merge.
- Optional: Select the checkbox next to Remove unused fields to remove fields that weren't specified in the merge.
- Optional: Select the checkbox next to Remove unused regions to remove regions that weren't specified in the merge.
- Optional: Select the checkbox next to Remove containing fields to remove fields that contain other fields.
- Optional: Select the checkbox next to Remove static fields to remove fields that remain the same upon any document changes.
- Optional: Select the checkbox next to Clear mail merge settings to remove existing mail merge settings.
- Optional: Select the checkbox next to Replace non merge fields to merge other types of fields.
- Optional: Select the checkbox next to Merge duplicate regions to merge multiple duplicate table fields.
Note: To learn more about setting up a table mail merge, go to Set Up Table Mail Merge.
-
Advanced
Click the Advanced button at the top of the Properties Pane to view and configure these properties.
To configure the Advanced property box
- Select the Update Word Document activity in the Designer Pane.
- Click the Advanced button at the top of the Properties Pane.
- Under Advanced in the Properties Pane, select or clear the following options:
- Create new document: Creates a new document that contains the changes made by the activity.
- Convert to PDF: Converts the resulting document to PDF format.
- Rename Document: Change the name of the document to the value in the text box.
- Overwrite source document (activity source): Overwrites the source document from an activity.
- Emit email token: Creates a token containing the resulting content.
- Report serialization warnings: Displays serialization warnings in the Messages tab.
- Accept revisions: Accepts all revisions from the Track Changes feature of Microsoft Word.
- Comment Options:
- Ignore: Ignores comments made in the document.
- Accept: Accepts comments made in the document.
- Remove: Removes comments made in the document.
Note: If you have more than one connection profile for your workflow definition, the Connection Profile property box lets you specify which connection profile this activity will use.