Subscribe to News feed

Convert InfoPath to MS-Word, Excel, XPS and PDF using the Muhimbi PDF Converter

Posted at: 5:47 PM on 24 February 2012 by Muhimbi

InfoPath-to-Others-2Earlier this week I posted about the fact that the Muhimbi PDF Converter Services and the PDF Converter for SharePoint now support output to formats other than PDF. This opens up a whole new world of possibilities such as converting between DOC and DOCX, XLS and XLSX, but more importantly it also supports converting between completely different document types such as Excel to MS-Word and HTML to Excel.

This post describes another new conversion type that should be of particular interest to our InfoPath customers as it is now possible to convert InfoPath forms to MS-Word, Excel and HTML.  

Conversion to these new formats generally works very well, but there are some limitations due to the nature of these non-PDF based destination formats. Specifically:

  1. Attachments: When converting an InfoPath form to PDF we also convert all attachments and merge them to the main PDF. This is possible because you can represent almost any file format in PDF and merge them together. Unfortunately this is not possible when converting to HTML, MS-Word or Excel.
  2. View Selection: We provide a number of ways to specify which view or views to convert. When converting to PDF it is possible to specify multiple views, which our converter then merges together into a single document. When converting to HTML, MS-Word or Excel it is only possible to convert a single view as these file formats don’t make merging easy. As a workaround you can create a ‘conversion specific view’ and combine the content of multiple views in it.
    Print Views are also ignored when converting to HTML, Word or Excel. Instead you will need to use Muhimbi’s View Selection facilities if you wish to convert any view other than the default View.
  3. Formatting: PDF is a super flexible format that allows any content to be placed pretty much anywhere on the page. MS-Word, Excel and HTML are not necessarily this flexible. For example, Excel uses a ‘cell based approach’ to display content. If your InfoPath form is not specifically designed for export to Excel, e.g. it uses nested tables or different column widths across a page, then you may need to optimise your InfoPath form for conversion, or create a ‘conversion specific view’.


Detail about how to convert to these new document types (as well as to PDF) can be found here.


InfoPath to HTML (MHT)

When converting InfoPath to HTML the resulting file is a self contained MHT file that most modern browsers can display. All information including images, HTML and style sheets are included in this single file.

InfoPath-PDF-HTML From left to right, the same Form in InfoPath, converted to PDF and converted to HTML Click to enlarge

As you can see in the image above, InfoPath data can be represented in HTML really well so it is usually not needed to make any changes.


InfoPath to MS-Word

Depending on how an InfoPath form has been designed, some work may be required to make things look better when converting to MS-Word. This is mainly due to the fact that MS-Word does not like dimensions that are expressed in percentages, while it is common in InfoPath to create a table grid and populate that grid with controls that take up 100% of the available cell space.

InfoPath-to-WordResults when converted to MS-Word before optimisation (left) and afterwards (right). Click to enlarge.

Looking at the ‘before optimisation’ conversion results in the image displayed above, there are 2 things that are not quite right:

  1. Dimension of text fields: The dimensions of most text fields are not quite right. This can easily be changed by opening the form in InfoPath Designer and changing the width of the various fields from ‘100%’ to the actual dimensions in cm or inches.
  2. Missing ‘year’ in date picker fields: Due the way the Date Picker is structured internally, modifying its width does not translate properly when displayed in MS-Word. To solve this change the date picker field to a regular text field either by creating a conversion specific view, or using a display rule.


The InfoPath to MS-Word facility can generate output in doc, docx, rtf, txt, html and odt formats.


InfoPath to Excel

InfoPath to Excel conversion for existing forms, which are not optimised for conversion to Excel, are probably the trickiest ones to get right. If you don’t care about the ‘look and feel’ of the Excel sheet then no change is required, but if the Excel forms need to ‘look good’ then you may need to rethink the way the form is designed.

InfoPath-to-ExcelResults when converted to Excel before optimisation (left) and afterwards (right). Click to enlarge.

Looking at the ‘before optimisation’ in the image above things don’t look too bad, but clearly it is not the same as the original. The main issues are as follows:

  1. Column Widths: As Excel uses a cell / grid based approach it is not possible to mix different column widths. The information in the form’s header requires different column width and spans than the columns used in the repeating table further down the page. By changing the horizontally oriented fields in the header to individual rows we no longer have this problem.
  2. Number formats: Depending on a cell’s content Excel sometimes tries to be ‘clever’. Most of the time this works great, but in this case a field with value ‘007’ is changed into a ‘7’. This could be fixed by changing the content of the InfoPath field into a formula and concatenating an apostrophe in front of it.


The InfoPath to Excel facility can generate output in xls, xlsx, csv and ods format.

In conclusion these new file formats work very well, especially if you are willing and able to make some tweaks. If you have any questions then either contact us or leave a comment below. We’d love to hear from you.


Labels: , , , , , , , ,

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

Posted at: 4:44 PM on 22 February 2012 by Muhimbi

DOC-to-DOCX-XLS-to-XLSXWe 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, Office 2007-2010 formats. 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 guys in IT are saving documents in Office 2010 format. 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.


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.


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. ‘http://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.



Similar to all other functionality provided by the PDF Converter for SharePoint, this new Workflow Activity works on all SharePoint 2007 and 2010 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.


Labels: , , , , , ,

Need support from experts?

Access our Forum

Download Free Trials