3

Is it possible to programmatically generate an info path 2007 form template (xsn file=form definition) ?

I know that there is no object model for the infopath 2007 form designer, but does anyone know of any third party libraries?

The form view itself is a xsl file so it should be possible. I would have thought that its a common use case also.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Matt Randle
  • 1,885
  • 2
  • 17
  • 22
  • use can use below links: 1. http://support.microsoft.com/kb/892730 2. http://www.kindohm.com/archive/2008/01/10/programmatically-create-an-infopath-form-instance-from-xsn-template.html They might be helpful. – Amir Jan 19 '12 at 10:02
  • @Amir, your both links are irrelevent to question asked. The 1st link is "How to encode and decode a file attachment programmatically" and the 2nd one is "Programmatically create an InfoPath form instance from XSN template", i.e. one should already has XSN template to programmatically generate Infopath XML data forms – Gennady Vanin Геннадий Ванин Mar 30 '13 at 07:42
  • You are correct in 1st link and you can use [my question](http://stackoverflow.com/questions/9088172/create-infopath-instance-from-xsn-template) instead of 2nd one. – Amir Apr 01 '13 at 17:53

2 Answers2

1

It is possible to generate the manifest.xsf, xsl and xml files from a structured source (let's say an xml) and then pack this (as .cab) with the extension .xsn
(The .xsn file is nothing but a renemed .cab!)

This is only a raw concept - it could be refined if the purpose was a bit more explicit. Why generate? Are you going to create a bunch of different files? What for?

MrFox
  • 3,233
  • 6
  • 25
  • 27
  • Furthermore, if all these forms have certain fields in them, he can add them to infopath and then go to file>save as source files so that he has a template off of which to base his files. – Matt Boehm Jun 04 '09 at 20:03
1

There are no libraries or API's to do this. While generating a template is possible you will need to write it all yourself. Obviously this will not be an easy task and will be prone to errors. I would recommend reviewing your requirements to ensure this is truly necessary. InfoPath is quite flexible, without knowing the details of your project, there is a good chance you can get the functionality you need with a single template.

sealz
  • 5,348
  • 5
  • 40
  • 70
oillio
  • 4,748
  • 5
  • 31
  • 37