Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / August 2005

Tip: Looking for answers? Try searching our database.

Coding Infopath to Word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
K''''ur - 11 Aug 2005 21:00 GMT
Hi,

Is it possible to take the Template.XML file of the infopath form and
convert that into MS word format, completely by custom coding but by an
automated process. What we want is:

-  Create an infopath form which will be populated with variety of data
coming from differeent sources through webservices.

-  Once the form is opened the user will be able to add in some of his/her
own data to certain fields

- After that we would like to store the infopath form as it is (i.e. with
whatever data is filled) in infopath format and a button which will generate
a customized .doc file of the form with the filled data.

How do we do this. A detailed answer will be greatly appreciated.
Thanks,
Keyur Shah
G. Tarazi - 11 Aug 2005 23:57 GMT
If it is just normal fields, yes

Once you have rich text boxes, repeatable sections, etc, ... forget it :-)

> Hi,
>
[quoted text clipped - 16 lines]
> Thanks,
> Keyur Shah
K''''ur - 12 Aug 2005 15:43 GMT
Hi, I would greatly appreciate if you could be little more specific. I need
to explain this to someone else.

Thanks in anticipation,
Keyur

> If it is just normal fields, yes
>
[quoted text clipped - 20 lines]
> > Thanks,
> > Keyur Shah
H Lim - 12 Aug 2005 20:47 GMT
Hi Keyur,

Check out this link,
http://blogs.3sharp.com/Blog/davidg/archive/2004/12/17/183.aspx, should able
to get you started.

Hope this help.

> Hi, I would greatly appreciate if you could be little more specific. I
> need
[quoted text clipped - 30 lines]
>> > Thanks,
>> > Keyur Shah
Tim Larson - 13 Aug 2005 02:48 GMT
This is possible.
1) Add a button to your IP form.
2) Add managed code to open a word application object.
       Private wordApp As Microsoft.Office.Interop.Word.Application
       Private wordDoc As Microsoft.Office.Interop.Word.Document

       <InfoPathEventHandler(MatchPath:="launch_Word",
EventType:=InfoPathEventType.OnClick)> _
               Public Sub launch_Word(ByVal e As DocActionEvent)
'save file file so it can be opened by Word. Cannot have it open in IP and
Word 'simulataneously
           thisXDocument.SaveAs(pathway + thisFilename + ".xml")
'save file again IP but in another name
           thisXDocument.SaveAs(pathway + thisFilename + DOVString + ".xml")
           Try
               wordDoc = wordApp.Documents.Open(pathway + thisFilename +
".xml")
           Catch ex As Exception
'so you don't get multipal wordapp objects open
               wordApp = CType(CreateObject("Word.Application"),
Microsoft.Office.Interop.Word.Application)
               wordDoc = wordApp.Documents.Open(pathway + thisFilename +
".xml")
           End Try
           wordDoc.SaveAs(pathway + "word files\" + thisFilename +
DOVString + ".doc")
           wordDoc.Application.Visible = True
           wordDoc.ActiveWindow.Activate()
end sub

3) word will open the xml file But you have to have: added the IP schema
(usually  mySchema.xsd) to the Word thru the Tools menu  drop down -> the
templates and add-ins  as well your .xsl file that uses wordML to translate
the .xml file generated by IP. You add this .xsl file through the schema
library. Select mySchema then add solution and then browse to your .xsl file.

Lastly I know I had to get permissions as a trusted source for the managed
code to be opening Word. that is another topic and it is addressed elsewhere.

Hope this helps
Signature

Tim

> Hi Keyur,
>
[quoted text clipped - 38 lines]
> >> > Thanks,
> >> > Keyur Shah
K''''ur - 15 Aug 2005 15:57 GMT
Thanks a lot to all of you. I will try with all this different options, and
might have more questions. hopefully not.

Thanks again,
Keyur

> This is possible.
> 1) Add a button to your IP form.
[quoted text clipped - 79 lines]
> > >> > Thanks,
> > >> > Keyur Shah
G. Tarazi - 13 Aug 2005 14:01 GMT
Ok, here is a bit more about Word and InfoPath compatibility.

Ok, let's start from the beginning, the InfoPath Form, is an xslt template
that receives an XML file and generates an HTML file.

The InfoPath product, is Internet Explorer enhanced, redesigned to view
these html files the way you see them in the product (using mshtml.dll).

Microsoft Word is a document processing product; it has some internal
presentation language to describe how the document looks like.

Microsoft created an XML implementation of this language, and now it is
called Word ML, and there is an internal hidden converter from Word ML to
the internal document language of Word (inside the product itself).

In other words, when you double click the WordML file, an internal
conversion is happening immediately from Word ML to whatever that product
uses.

Now about compatibility.

InfoPath stores the data of the rich text boxes as XHTML, Microsoft WordML
has no clue of how to display XHTML, Microsoft Word itself has a basic idea,
but not able to do that correctly either.

In other words, if you build the WordML file manually, and inject the XHTML
inside, Word won't be able to display it.

And if you call word directly (using the word object module), and use it to
transform the XHTML (the contents of the rich text box), you will get a
crappie transformation, missing contents, or improperly aligned tables,
or ... you name it, they have it.

In other words, the nicely formatted contents of InfoPath, are not nicely
formatted in Word after the transformation (if you get it to work).

And that was just about one type of fields only

Now take this to the rest of the product, and you will find a different
problem with each filed, either minor, or major.

I just don't understand the product managers of Office when they talk about
computability of the office products, and how can you use InfoPath and Word
together, yeh right, good luck :-)

> Hi, I would greatly appreciate if you could be little more specific. I
> need
[quoted text clipped - 30 lines]
>> > Thanks,
>> > Keyur Shah
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.