Word Automation Service in SharePoint enables the conversion of the documents supported by Microsoft Word. This Service is provided as a Service Application in SharePoint. Conversion of the documents is not present as an On Demand Service. Instead, the conversion of the job is handled by a timer job called Word Automation Services. It is set to run after every 15 minutes. During its run, it picks up the conversion jobs and performs the conversion of the documents. Thus, in order to perform document conversions, ensure that Word Automation Services Application is created.
Also make sure that the service is started.
You can read more about Word Automation Services here. In this article, we will see how to implement Document conversion jobs in SharePoint, using Nintex Workflow 2016.
Getting Started
Create a document library, where the documents to be converted will be stored. Let’s create the library WordToPDF that will store Word documents to be converted to PDF.
Add Nintex Workflow to Library
Now, let’s add the Nintex Workflow by selecting “Create a Workflow in Nintex Workflow” option.
Drag and Drop Regular Expression action to the Workflow designer. Regular expression will be used to get the document's current name along with the extension. The extension will be then replaced with the converted document’s extension, so that it can be assigned to the converted document.
Select the Configure option from the drop down.
Let’s create a Workflow variable, which will hold the converted document's name, which will be used in the Workflow.
Select the New button.
Specify the variable name and the data type.
In the Pattern text box, specify the current document extension, doc|docx. In the Replacement text box, specify the destination document extension, PDF. This will help us to get the PDF document name, which will be assigned to the converted document.
In the input text, specify the Item URL.
Convert Document Action
Once we have assigned the variable with the destination document name that will be assigned to the converted document, add the action Convert Document.
Select Configure action from the drop down.
Specify the values for the parameters, mentioned below of the action.
Source
Set it as Current item
File type
Set is as Automatic
Output URL
Set it to the variable that was configured earlier.
The Workflow designer will now look, as shown below.
Now, we have to set the Workflow triggering condition. Select Workflow settings.
Currently, we will set it to start manually.
Now, let’s go ahead and publish the Workflow.
Finally, the Workflow has been published.
We can test out the Workflow by going to the Library.
Once the document has been uploaded, click Start to invoke the Workflow.
It will start the Workflow.
However, the Workflow is dependent on SharePoint Timer Job Word Automation Services Timer Job.
By default, it is set to run every 15 minutes so the document conversion jobs can take up to 15 minutes to complete. However, you can force run the timer job to kick start the conversion job.
Once it is run, the document will be converted to the destination format. Here, we had uploaded a .docx file. On running Nintex Workflow, it has converted it to a PDF document.
We can test the PDF document by opening it up in the Browser. It has been converted from the uploaded DOCX document successfully.
We had written the rule doc|docx in the regular expression action, so that both the file formats will be converted to PDF. Let’s test out that test case a well. Previously, we had uploaded DOCX. Let’s upload .DOC file as well and see the Workflow in action.
Start the Workflow manually.
The document conversion jobs have been completed and it has successfully converted DOC as well as DOCX to PDF documents.
Summary
Thus, we saw how to implement document conversion jobs in SharePoint Server 2016, using Nintex Workflow 2016.