Convert Infopath to Word Programatically in Sharepoint Workflow

K

kiranpost1090

I am working on a sharepoint workflow which is attached to a form library.
Can i convert the infopath to web(.mht) or PDF programatically and save it to
another document library.

There is an option through UI where you can export the infopath to Web or
PDF, but i need to do it from my workflow code.

Thanks,
Kiran
 
G

Gavin McKay

Hello,

This is a solution I've use in early 2007, so there may be a better way to
do it now. I hope there is :) This way is not simple at all and requires
several steps to get it to work. We needed this solution in order to covert
any InfoPath form to a PDF on demand as a background process, without loading
the InfoPath client. We couldn't find a way to do this simply, hence the
following solution...

The basic process is as follows:
1. Create an InfoPath view that will be formatted for your printing
2. Extract the XSL from the InfoPath template and store somewhere for later
use (by saving InfoPath template as source files)
3. Use .NET (or similar) to transform the InfoPath data (i.e. Xml file)
using your XSL file into HTML (which is what InfoPath does when it displays a
view)
4. Use a HTML->PDF utility to create the PDF (there are heaps of 3rd-party
solutions to do this)

You can then call your process whenever you want to transform an Xml file
and generate your output.

Some traps:
- If you are adding images to your InfoPath output InfoPath auto-renames
them to keep them unique, so you usually need to manually find the name of
the image file in your XSL file so the converter can reference it
- Upgrades to your Xml may be required to get your output correct if you are
making changes to your InfoPath form

Like I said, this is doable but not nice. If I get some time this week I'll
write up some more detailed instructions.

HTH

Gavin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top