How to Convert Word Document to XPS Using SharePoint Designer 2010 Workflow

Here we can see, how to use a custom action within SharePoint Designer to create a custom workflow that can use the Word Automation Service to convert a document into XPS format and then declare it as an in-place record in a document library.

Here we will go through following main steps:

  1. Set up the environment.
  2. Create a workflow to convert a document using the Word Automation Service.
  3. Test your workflow.

Ensure that Word Automation Services starts:

  1. Open the SharePoint 2010 Central Administration web site by going to "Start | All Programs | Microsoft SharePoint 2010 Product | SharePoint 2010 Central Administration".
  2. Select Yes if a User Account Control (UAC) dialog displays asking if you would like to give this program permissions.
  3. When the SharePoint 2010 Central Administration page opens, under the Application Management section, click the Manage Service Applications hyperlink.
  4. Ensure that Word Automation Services starts.

Reduce the Time between Timer Job Runs

This task provides us with faster feedback when your timer job runs. Changing this setting on a production environment may result in performance degradation.

  1. Open the SharePoint 2010 Central Administration web site by going to "Start | All Programs | Microsoft SharePoint 2010 Product | SharePoint 2010 Central Administration".
  2. Select Yes if a User Account Control (UAC) dialog displays asking if you would like to give this program permissions.
  3. When the SharePoint 2010 Central Administration page opens, click the Monitoring link.
  4. Click the Review job definitions in Timer Jobs.
  5. Click the Word Automation Services Timer Job. You need to page through to get to this.
  6. Change the Recurring Schedule to be Every 1 minute(s).
  7. Click OK.

Using a Custom Workflow Action in SharePoint Designer

Now that we have configured WAS to run every minute, you can build a custom workflow to make use of this. We have supplied a sample action to use to showcase the feature.

  1. Browse to your application.
  2. Navigate to the Shared Documents document library.
  3. In the Library tab of the Ribbon, in the Settings group, select the Workflow Settings button.

    ShrWrk1.jpg
     
  4. Click Create a Workflow in SharePoint Designer.
  5. You may see a warning from Internet Explorer informing you that "A Website Wants to Open Web Content Using This Program on Your Computer". If you see this message, click Allow.
  6. SharePoint Designer now loads.
  7. To add a new workflow to your list, enter a name (Convert Document t XPS) and description.
  8. Configure the action as follows:
    URL: [%Current Item:Name%]
    Output Format: XPS
    Job ID: Variable: conversion job id
    Overwrite status: Always overwrite
  9. Click the Check for Errors button in the Save group on the Ribbon. You should get a dialog box informing you that The Workflow Contains No Errors.
  10. Click the Publish button in the Save group on the Ribbon.
  11. Your workflow is now published.

Test the Workflow

  1. Browse to your site.
  2. Navigate to the Shared Documents document library.
  3. Select a document within the document library, and click the Edit Properties button within the Documents tab on the Ribbon.
  4. In the Start a New Workflow section, click the link to Convert Document to XPS.
  5. Click Start.