SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: Mail Merge?

  1. #1
    SitePoint Member
    Join Date
    May 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mail Merge?

    Hi,
    Is there a way to do a mail merge (data coming from sql server) from a web form?

    I've looked into Word Automation, but for this you need Office installed on the server, and even then the mailmerge might just open on the server.

    I've also tried looking into Open Xml but wasn't able to open a Word document.

    Any help is much appreciated!

    Thanks!

  2. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,633
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Can the users directly access the SQL server? If so, you could let them pull the mail merge data directly from Word.

    If you need to give them the data from the web, then one place you might want to look at is using Excel 2007's XML-based file format to serve excel files which they could then hit from Word.

    There are some other possibilities, key questions being:

    1) Can the users access the DB server directly?
    2) What are the processing requirements?

  3. #3
    SitePoint Member
    Join Date
    May 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes users can access the database directly. But the peoblem with this is users wouldn't be able to filter down contacts.

    The ideal solution would be for users to filter down contacts on a web page, click a button and then Word opens with the data already merged.
    This is how it works locally with the Word Automation but I later realised this might not work on a server.

    Is there a way to do this?

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,633
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Without diving too deep into Word, not really. We looked at creating a custom form in Word to help users setup data sources by essentially grabbing a list of pre-canned queries from the application, but we settled on letting users filter the views and export anything to excel. Ended up being much cleaner (no end users actually in the DB, no client installation maintenence issues) and the users were generally happy.

  5. #5
    SitePoint Member
    Join Date
    May 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats one way of doing it but the problem I've got is the end users aren't very computer literate. Don't think they'd be able to do a mailmerge with even an excel document.

    At the moment I'm looking into linking Word to a View in sql server and seeing if it can be done that way - hopefully easily.

  6. #6
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,633
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    That should work well enough, presuming your app just has one "view" you need to export. We have a few things that work like that with no real complaints (besides that department's screwy fetish with insane levels of perfection in reporting).

    As for the excel angle, you can "pre-can" the merge document to talk to the spreadsheet schema. Then all you need to do is teach the end users how to open said word doc, find saved spreadsheet and fire off the merge.

  7. #7
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    We use Aspose Words for all our automated document creation/mail merge stuff. It's pricey, but the ROI is very quick once you start fully using it


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •