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: [email protected] [mailto:[email protected]]
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: [email protected]

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:
<http://www.facebook.com/pages/Brisbane-Australia/Castner-IT/291936316886?v=
info> facebook.com/castnerit

 


On 8 August 2011 00:47, Les Hughes <[email protected]> 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
[email protected]





 


Reply via email to