exporting form data to word

R

Rhonda

Hi all,

I have a rather unique request from on of our departments and I have no idea
of how to go about implementing it. Here is a scenario.

When one of our sales guys makes a sale, they fill out an InfoPath form that
is routed to Finance that gives them all the information they need to enter
the new customer into SAP and send an invoice. The sales person will also
frenquently fill out a word document that is routed to our Marketing site
that can be used for case studies etc. A lot of the data is the same in the
Word doc as it is in the InfoPath form (ie. Customer name, address, products
purchased, etc.). What the users would like to do is at the time they are
filling out the InfoPath form, check a check box that says something like
"Create Marketing Doc", once they submit the form, the Word doc (which is on
our Sharepoint site) would automatically open with as much of the data that
can be populated from the InfoPath form already entered. That way they don't
have to enter the data again in a different place. The marketing team is
insisting on using this already formatted Word doc so we are pretty much tied
to using it. Does anyone know how this can be done?

Code samples and detailed explanations would be greatly appreciated since I
am fairly new to InfoPath.

Thanks a ton in advance,
 
S

S.Y.M. Wong-A-Ton

I recently wrote an article about exporting InfoPath forms to Word. See
http://enterprise-solutions.swits.n...-send-email-attachment-outlook&c=infopath2003

You could modify this code to exclude the email part, just print the Word
document, and instruct users to publish their Word document to the SharePoint
library when they are done. Or you could write code to automatically publish
the generated Word document to the SPS library. While I have never tried the
latter, it should be doable.
 
R

Rhonda

That appears to be taking the InfoPath and importing the form and styles
exactly as it is into Word. I don't want the full form in Word. I just need
to populate an existing Word Template with bits of the data from the form.

Thanks anyway,
 
T

TomTom

Facing the same problem.
Got a infopath 2007 form.
And got a Word template.
But how to assign the xml data to the word form ???
 
S

S.Y.M. Wong-A-Ton

Actually, it is not importing the form; the data within the form is being
transformed into a WordML document. What the XSL stylesheet does for you is
loop through all the nodes within the InfoPath form and transform them so
that they conform to the Word document you want.

If you want only bits of data from the form, you can build in logic in the
XSL stylesheet to only use certain fields from the InfoPath form based on
certain criteria, or write your own code in InfoPath to loop through all the
fields in the InfoPath form and construct the XML for your Word document. The
latter is much more labour intensive.

Another option is to use the new OpenXML file format of Office 2007 to
replace certain parts of a docx document with information from InfoPath.
 
E

elin

Hi S.Y.M. Wong-A-Ton, I am struggling with the same problem and I am using
Office 2007, can you give me more information on how to replace certain parts
of a docx document with information from InfoPath?

Thanks,
Elaine
 
S

S.Y.M. Wong-A-Ton

Hi Elaine,

Sure thing!

First things first: You need to read up on the new OpenXML format that Word
uses. Use these links:
http://msdn2.microsoft.com/en-us/library/ms771890.aspx
http://msdn.microsoft.com/msdnmag/issues/06/11/BasicInstincts/default.aspx
http://blogs.msdn.com/brian_jones/

Then, if you are using InfoPath 2003 and Word 2007, you'll need Visual
Studio 2005, the InfoPath 2003 Toolkit for Visual Studio 2005, and the .NET
framework 3.0 runtime to be able to manipulate docx files from within
InfoPath.

Unfortunately, I do not have an InfoPath 2003 / Word 2007 environment to
test things out on, so I've created a solution for InfoPath 2007 / Word 2007
environments. Note: The latter environment requires Visual Studio 2005, VSTO
2005 SE which contains a template to create InfoPath 2007 code behind forms,
and the .NET Framework 3.0 runtime to manipulate docx files from within
InfoPath.

The solution I've created can be found here:
http://enterprise-solutions.swits.n...ord-2007-document-xslt-c-sharp&c=infopath2007

Good luck!
 
E

elin

Happy New Year, S.Y.M Wong-A-Ton. Wow, thanks, this is such a great new year
gift!
While I was waiting for your reply, I viewed a webcast called "Creating and
Deploying Custom Document Information Panels for Word 2007,
http://blogs.msdn.com/infopath/arch...ment-information-panel-and-word-document.aspx"
which help me understand the relationship between InfoPath 2007 and Word
2007. I am posting my InfoPath form on Sharepoint 2007 for users to fill out.
My goal is to auto create a Word document once the user submit the form with
the information that is on the form. But I don't know how to bring up the
Word template and populate the fields from InfoPath 2007. Do you think
binding the data between DIP and Word is a better way to go since I am using
SharePoint 2007?

Thanks,
Elaine
 
S

S.Y.M. Wong-A-Ton

So you managed to create the XSL file? Great! Now you need to install VSTO
2005 SE (see
http://www.microsoft.com/downloads/...b3-6fd6-4955-b979-e1676db6b3cb&displaylang=en).
This will give you an InfoPath project template in Visual Studio and allow
you to create an InfoPath form in Visual Studio. And if you do not already
have the .NET 3.0 Framework installed, you can get it here:
http://www.microsoft.com/downloads/...0B-F857-4A14-83F5-25634C3BF043&displaylang=en

I'm sorry. Unfortunately, I currently do not have an alternative route. If
you do not have programming experience in Visual Studio, this could turn out
to be a very big challenge. :) I try to keep things as simple as possible for
people, but am not always able to achieve this. Is there anyone around you
who might be able to help?
 
E

elin

I have installed VSTO 2005 SE, tried to add the InfoPath form control to the
toolbox but when I click on Choose Toolbox Items from the Tools menu, click
on the .NET Framework Components tab, I couldn't locate the FormControl
component (Microsoft.Office.InfoPath namespace), I see several components for
Microsoft.Office.Tools.Excel and Microsoft.Office.Tools.Word. What am I doing
wrong?

I have also installed .NET 3.0 Framework, but I couldn't find WindowsBase
DLL when I go the Solution Explorer and click on the References node to add
the DLL. I have reboot my machine a couple of times after the install, still
nothing show up. What am I doing wrong again?

I really appreciate your help.
Thanks,
Elaine
 
S

S.Y.M. Wong-A-Ton

I currently do not have an environment in front of me, so will try to lead
you blindly...

No need to add InfoPath form control to the toolbox. You need to go to the
File menu, and create a New Project. Look whether you see an "Office"
category on the New Project dialog box. There should be an InfoPath project
template listed under it. Select that to create your new project.

I'm not sure why the WindowsBase DLL does not show up. Are you looking under
the .NET tab? You can also browse to find it. I think it was located
somewhere in Program Files.
 

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