Blog Post

Convert document types using the PDF Converter for SharePoint (xls to xslx, doc to docx)

Clavin Fernandes
Illustration: Convert document types using the PDF Converter for SharePoint (xls to xslx, doc to docx)

We have known for a long time that this day was coming, but the PDF Converter for SharePoint is no longer limited to generating just PDFs. So now we have a product that doesn’t quite describe what it does…GREAT! Oh well, the good news is that once again we have added some excellent new functionality that allows documents to be converted to types other than PDF.

So, how is this useful? Well, let’s say that you have a large amount of legacy Office 97-2003 files, but your company now requires all files to be saved in the more modern, and open, Open XML Formats (docx, xlsx, pptx). By using the Muhimbi PDF Converter you can convert between these formats automatically using a SharePoint workflow or a simple web service call using Java or .NET.

Naturally you can go in the other direction as well. For example many users in your company may still be on Office 2000 or 2003, but those fancy people in IT are saving documents in Open XML Formats (docx, xlsx, pptx). No-one else in the organisation can open these shiny new files using their geriatric versions of MS-Office / Open Office. A simple SharePoint workflow will automatically take care of this and convert the file to the desired format.

Naturally we have to be realistic about which files to convert between. Going from AutoCAD to Excel makes no sense, but from Excel to Word and Word to Excel could be useful. The table listed below shows which file formats can be converted between.

Transformation-Matrix

Some points of interest:

  1. It is now possible to convert InfoPath files to MS-Word, Excel and HTML (PDF and XPS was already possible).

  2. Although not displayed in this chart, it is also possible to convert PDF (and any other file type) to PDF/A.

  3. It is even possible to ‘convert’ to the same format as the source, e.g. docx to docx, but specify additional settings such as a password on the document.

Convert using Web Service calls

Converting files to non-PDF formats using web service calls works identical to converting files to PDF. The only difference is that the Format property on the ConversionSettings object must be set to the file type you are converting to. For details see the existing Convert to PDF sample code for Java and .NET.

Convert using SharePoint Workflows

Converting a document using SharePoint Designer workflows ( Nintex version here) works similar to converting to PDF. The main difference is that you now use the Convert Document Workflow Activity rather than the Convert to PDF one.

After adding the new activity to your workflow you will see the following Workflow Sentence.

Convert-Document-(empty)

The workflow sentence is consistent with our other Workflow Activities (e.g. Converting / Watermarking / Splitting / Merging), and is largely self-describing.

  • This document: The document to convert. For most workflows selecting Current Item will suffice, but some custom scenarios (List or Site workflows) may require the look up of a different item.

  • This File: An optional filename (and path) to write the converted document to. When not specified, the same name as the document that triggered the workflow will be used, just with a different extension. Please make sure that the path does not include the host name, e.g. ‘https://your site/…’., see this post for details about specifying paths.

  • Select file type: Select the type to convert to from the drop down menu.

  • Include / exclude meta data: In case of sensitive documents you may want to strip any custom SharePoint columns from the file. For example, if your document library contains a column named ‘Yearly sales forecast’ then you may want to select ‘Exclude’.

  • Optional parameters: Override default conversion settings, for details see this post.

  • Parameter ‘List ID’: The ID of the list the converted file was written to. This can later in the workflow be used to perform additional tasks on the file such as performing a check-in or out.

  • Parameter ‘List Item IDs’: At the moment this workflow activity will always generate a single output file. However, in the future it will be possible to generate multiple output files in one go, in which case this parameter will return a string with ‘;’ separated values of the generated item IDs. This list can then be used by other (custom) activities, e.g. the ones created by our Workflow Power Pack, to process the individual files further.

A basic sample workflow is included below, by attaching this workflow to a Forms Library any InfoPath form saved in it will automatically be converted to an MS-Word 2007 file.

Convert-Document-(filled-out)

Similar to all other functionality provided by the PDF Converter for SharePoint, this new Workflow Activity works on all SharePoint 2007/2010/2013/2016/2019 and SE editions.

For a more complex scenario see the existing blog post about the PDF Conversion Activity.

If you have any questions then either contact us or leave a comment below. We’d love to hear from you.

Author
Clavin Fernandes Developer Relations and Support Services

Clavin is a Microsoft Business Applications MVP who supports 1,000+ high-level enterprise customers with challenges related to PDF conversion in combination with SharePoint on-premises Office 365, Azure, Nintex, K2, and Power Platform mostly no-code solutions.

Explore related topics

Share post
Free trial Ready to get started?
Free trial