Export data to a Word Doc

Export data to a Word Doc

  
Hi all,
I've spent two days researching all the many posts relating to creating a word doc from a web screen and so far I can't find a solution that works for me. I'm using V7
 
My requirement:
From an edit record screen I want to have a button that creates a word document containing specific fields on the screen. I want to control where the data is placed on the word page using bookmarks.
Does anyone have an idiots guide (I'm working on a project for myself and am not a coding expert) or better still a working example I can look at.
Many Thanks,
Gary
Gary -

DOCX's are just ZIP files with XML documents, it should be pretty easy to do what you need by doing an extraction and edit of the XML. If you want something more robust, I have had excellent succes with Syncfusion's components, wrap them in an Extension in Integration Studio and away you go.

J.Ja
Thanks Justin,

Unfortuantely I don't have enough experience to understand how to 'extract and edit the XML'
Do you have any pointers?

Regarding Syncfusion's components - where would I find those?

Apologies if these are simple questions, but I'm working on something for myself and as such learning as I go!
Cheers
Gary
Gary -

I beleive there are some components for ZIP file manipulation either built into the platform or available on the forge; use those to extract the files. Then you can manipulate the XML documents either through other extentions or just as text. The Office 2007 file formats are well documented, and you should be able to find the information on Microsoft's Web site.

The Syncfusion components are not cheap (roughly $1,000 when I bought them a while ago), but worth every penny when you consider how much time it could take you to work with these things otherwise. You best choice, if you go that route, is the write the code for the processing in a .NET extension in Integration Studio.

J.Ja
I believe there was already a post how to do this ... search for it,
Otherwise I'll have a look in my mail to see what support told about this !
Found a post on the forum talking about it, but not a detailed "how-to" ... http://www.outsystems.com/forums/discussion/5822/creating-a-word-docx-from-outsystems/
Hi All,
Unfortunately I still don't know where to go. Joop, the post you mention isn't actually what I'm trying to achieve.
For clarity I've created a jpeg showing my plan (doesn't work yet!) - my web screen and a button that when pressed creates a word doc with fields from the screen placed in specified positions on the page of the document.
My problem is how to populate the word doc with my data.... All I have so far is a webscreen with data and a blank word doc and a blank look on my face!!
Thanks
Gary
 
Hi Gary,

I did a simular thing in a project. I started with a template document and for the specified positions i created bookmarks (content controls is also an option).You can add your template as an recourse to your espace.
To fill the Word document create a custom extension which uses the open xml sdk 2.0 which you can download here: http://www.microsoft.com/en-us/download/details.aspx?id=5124

In the extension create actions like:
- open templatedoc
- fill bookmark/ content control
- save document

Check this link to get you started with the bookmarks and  the Open Xml SDKhttp://legalcube.de/post/Word-openxml-sdk-bookmark-handling.aspx

Other good resources to get you started with the Open Xml SDK
http://ericwhite.com/blog/
http://openxmldeveloper.org/

Hope this helps.

regards,

Stephan
Thanks Stephan,
Having never created an extension I'm realising I'm out of my depth here!
Surely this ought to be a common requirement like the inbuilt export to excel?
Does anyone have a working example to save me days of getting lost?
Thanks
Gary
Gary,
I think I can help you with a working example (extension). On behalf of my collegue Stephan Schevers, who build an extension to add text to word documents, i post the extension for you. I created a new extension to generalise the functions. The extension must be fed with a dotx template file, contaning bookmarks,  from the local filesystem.

Hope this helps.

Dick Dokter
Attaching the extension went wrong! Hope it works now.

Dick Dokter
Gary,

here is the extension. For how to use see the instructions in the post from Dick Dokter

Somehow the extension I created won't upload :-(

regards

Stephan Schevers
Hi Gary,

there is an extension WordMerge, available in forge: http://www.outsystems.com/forge/61/extension-wordmerge/
that might be usefull for you. One  of its features is to perform mail merges, using Microsoft Word, between a word document template and excel data.

There are also several 3rd parties tools that allows you to create documents using Mail Merge techniques, like Aspose (this one is paid) check this post: http://www.outsystems.com/forums/discussion/5665/winword-alternative-for-mail-merge/

Regards,

Cláudia

Stephan Schevers wrote:
here is the extension. For how to use see the instructions in the post from Dick Dokter

Somehow the extension I created won't upload :-( 
 
Hey Stefan,

Upload it into the Forge !

Joop
Thanks to all,

I now have a few new routes to take a look at!
I'll report back as soon as I have a working oml & extension... might be a few days as I have a 'real' job to do too :-)
Gary