G'day Les,

Document creation (including complex mail merge) is simple with the OpenXML SDK 
and conversion to PDF is easy with Word Automation Services in SharePoint 2010.

I did a couple of posts on it back in the day.

Document Creation and Conversion with the OpenXML SDK and SharePoint 2010 Word 
Automation Services - Part 
1<http://blogs.msdn.com/b/acoat/archive/2010/06/19/document-creation-and-conversion-with-the-openxml-sdk-and-sharepoint-2010-word-automation-services.aspx>
Document Creation and Conversion with the OpenXML SDK and SharePoint 2010 Word 
Automation Services - Part 
2<http://blogs.msdn.com/b/acoat/archive/2011/04/06/document-creation-and-conversion-with-the-openxml-sdk-and-sharepoint-2010-word-automation-services-part-2.aspx>

Cheers

Andrew Coates, ME, MCPD, MCSD MCTS, Developer Evangelist, Microsoft, 1 Epping 
Road, NORTH RYDE NSW 2113
Ph: +61 (2) 9870 2719 * Mob +61 (416) 134 993 * Fax: +61 (2) 9870 2400 * 
http://blogs.msdn.com/acoat

From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On 
Behalf Of Rob von Nesselrode
Sent: Friday, 19 August 2011 5:58 AM
To: 'ozDotNet'
Subject: RE: Editing DOCX (mail-merge) and DOCX -> PDF

Les,

Bit late, but I've had a play recently with this from CodeProject:

http://www.codeproject.com/KB/office/Fill_Mergefields.aspx

>From the site: "Utility class for filling mergefields (loose fields and 
>tabular data) in a Microsoft Word (docx) template document, without needing 
>Microsoft Word itself"

This uses the OpenXMLSdk to play with the zipped xml.

Went as far as a working prototype for our app and its on the RSN shelf as I 
write.

I noticed what may be a bug - it appears to replace the whole contents of a 
cell that includes a merge field (when the field is within a table) - this 
changed my cell formatting. Since I have the source I should be able to sort 
that.

We will then render/email/print etc with one real Word instance on a server 
(where the docx/dotm files reside) which is easy enough to do with a wcf app 
that listens for file names and fires up word as required. Could use another 
rendering engine I guess - like Aspose. As long as you only need one instance.


Rob

________________________________
From: ozdotnet-boun...@ozdotnet.com<mailto:ozdotnet-boun...@ozdotnet.com> 
[mailto:ozdotnet-boun...@ozdotnet.com]<mailto:[mailto:ozdotnet-boun...@ozdotnet.com]>
 On Behalf Of Grant Castner
Sent: Monday, 8 August 2011 11:30
To: ozDotNet
Subject: Re: Editing DOCX (mail-merge) and DOCX -> PDF
Hi Les,
I use a combination of ckeditor, PDF metamorphisis, and the C# MailDefinition 
and Dictionary classes:

* Create a html template with merge fields (e.g. use @@FieldName@@)
* Users can edit the html template with something like ckeditor
* Use the Dictionary class to replace the merge fields in the template
* Create a pdf version of the resulting merged page using PDF Metamorphisis
* Create the email using the MailDefinition class

Cheers,
Grant


--

[http://www.castnerit.com.au/images/castnerITLogo_96x96.png]


Castner IT Pty Ltd
Dr Grant Castner
Director

e: gcast...@castnerit.com.au<mailto:gcast...@castnerit.com.au>

w: http://www.castnerit.com.au<http://www.castnerit.com.au/>
p: 0458 770 749

a: P.O. Box 952 Mooloolaba QLD 4557
twitter: @castnerit<http://twitter.com/CastnerIT>
facebook: 
facebook.com/castnerit<http://www.facebook.com/pages/Brisbane-Australia/Castner-IT/291936316886?v=info>




On 8 August 2011 00:47, Les Hughes 
<l...@datarev.com.au<mailto:l...@datarev.com.au>> wrote:

Hi All,

I currently have a legacy app which uses an Access database to do a mail-merge 
with Word 2003. Due to upgrades, all of the Access 03 stuff is getting its last 
rights. Since we are now SQL server with security, mail-merges are a little 
harder than before, and not really practical. (but maybe I'm missing something?)

A few questions:

- Any good advise/links on how to do a similar thing to mail-merges?
- I've been playing around with using System.Packaging to unzip the docx and 
find/replace on the merge fields.

I'd like to be able to export the docx file to PDF without having Word on the 
machine, I've had a look at Aspose.Words and it seems pricey for what I want to 
do (docx->pdf on multiple client sites = ~$3000). Does anyone have any advice 
or experience with one product over another?

I'm not 100% sure about what I am trying to do yet, so any 
info/stories/links/whatever would be appreciated.

Thanks :)
--
Les Hughes
l...@datarev.com.au<mailto:l...@datarev.com.au>





Reply via email to