Infopath form to HTML using csharp

I know converting Infopath form to HTML is pain task. Recently i have worked on one assignment where i need to send infopath form as email. So sending browser based infopath as email content is not possible so i decided to convert Infopath form to HTML and attach to email message. I have tried many method to convert infopath to html but all are ended with pain. At the end i found good solution so we can convert infopath form to html. I would like to share this approach because i’m sure you won’t get good solution by searching internet. Best method is using .net programming and using XSLT transform approach we can convert infopath form to HTML content. You can find the below steps to html conversion.

Creating the XSL file form infopath form 

  1. Open infopath form using Infopath form designer.
  2. Go to File -> Click on ‘Save as Source files’ menu will ask for location.  Save the content
  3. Goto saved location and you can find views.xsl file, It will be in XSLT format.
  4. Copy the views.xsl file to sharepoint 12hive Layout folder.

Below c# method used to convert xsl file to HTML. 

Calling below method will return the html string

That’s it, Simple isn’t it?  If you found this post useful then you can donate me to encourage writing more articles using below link.

Similar Topics:


convert infopath form to htmlconvert infopath to htmlinfopath htmlinfopath to htmlsharepoint 2010 convert infopath to html
We will send you more information on Infopath form to HTML using csharp.
Enter your email address:
This entry was posted in Sharepoint and tagged . Bookmark the permalink.

2 Responses to Infopath form to HTML using csharp

  1. ywang says:

    Could you be more specific as to the C# code to convert it into html? I’m new to C#, I’m not very proficient in C# code , could you please demo how it works ? You can email me .
    Thanks you so much

  2. Suraj says:

    Please could tell me what should be the SPFile or how to create the SPFile object.

    Appreciate if you can share the complete code.


Leave a Reply

Your email address will not be published. Required fields are marked *