Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all,
Vanilla are planning an update to the site on April 24th (next Wednesday). It is a major PHP8 update which is expected to boost performance across the site. The site will be down from 7pm and it is expected to take about an hour to complete. We appreciate your patience during the update.
Thanks all.

Extract From a DB to a word document

Options
  • 05-08-2007 2:23pm
    #1
    Registered Users Posts: 10,263 ✭✭✭✭


    Hey, I have a MySql database, and all the data in it is entered through a C# program i have. What I would like to be able to do is to create a word document template, like a form or something, so that when it's opened it grabs data from the database and fills in the blank fields... Is this possible by just using word alone? Or would it be better (or possible) to do this through Visual C#???

    Just looking for pointers/advice....

    Thanks.


Comments

  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    Have a look at "Mail Merge" in Word. Sounds like its exactly what you want.

    Its also definitely possible under C#, but I'm not sure how it would be better unless you've some requirements that aren't stated (e.g. its a multi-tier application where the client has no direct access to the DB).


  • Registered Users Posts: 10,263 ✭✭✭✭dulpit


    Basically what i have is that when my program runs, the user enters a lot of data, the ultimate reason is that he wants to view a report based on all the input... I can do that no problem in the program, but what would be handy is that at a later date the user could come along, choose the report he wishes to view and a word document would then be produced, which he can then analyse or send onto other people, whatever...


  • Moderators, Politics Moderators Posts: 38,849 Mod ✭✭✭✭Seth Brundle


    I did something like this recently (using VBA in Access). I created bookmarks in Word and then replaced then using the following:
    wordDoc1.ActiveDocument.Bookmarks("bookmark_name").Range.Text = strDatabaseText


  • Registered Users Posts: 23,212 ✭✭✭✭Tom Dunne


    I'm doing something similar in work, it's for a letter going to 16,000 people. :D

    Mail merge is what you want, but there are two ways you can do it. One way is to extract the data into a csv file and use that as the source for your Word document.

    The other is as the lads have said, directly from the DB itself.

    As a side note, if you are looking for a reporting solution for your database, have a look at LogiXML. Briefly, it's a web based reporting application and it allows you to export to a variety of formats, including Word, Excel and even PDF. There is a free version that is quite feature rich.

    Standard Disclaimer: I have nothing to do with LogiXML, I just find their products good.


  • Registered Users Posts: 10,263 ✭✭✭✭dulpit


    I'll have a look at everything suggested later, let ye know how i get on.... Must dash though, the Cork - Waterford game is on, come on the Rebels!:D


  • Advertisement
  • Closed Accounts Posts: 2,279 ✭✭✭DemonOfTheFall


    Thanks a million for the info about Logi therer Tom, been roaming the web for weeks looking for good reporting solutions. Everything so far has been
    1. Free solutions where we code our own XML -> Various formats.
    2. $5k+ systems that are beautiful and do everything for you.

    LogiReport seems to fit nicely in the middle!


  • Users Awaiting Email Confirmation Posts: 351 ✭✭ron_darrell


    I'll probably be shot for suggesting this but I currently use ASP (the old vanilla type) to output it's data to a word document for reports and labels and things like that. If it can be done in ASP it can surely be done in c#. If you're willing to 'downgrade' :) to ASP (and of course if you have a web server that can access you MySQL database) drop me a line and I'll show you how to code it.


  • Closed Accounts Posts: 18,056 ✭✭✭✭BostonB


    Theres lots of web reporting solutions like Crystal or even MS SQL reporting services etc. Or You can use adobe or word and use VBA with them. One of the systems I've built uses a ActiveX to check does word exist on the client, download the word template and csv then mailmerge them.

    Word and Excel can only run client side. So thats one limitation. Then you have problems with security and activeX and VBA macros/code. Some people block these. So theres a support issue there. There are other solutions that create PDFs or similar server side. Personally I dislike PDF's as less people have adobe reader installed than Office. And PDF's are a lot bigger than word docs to download.

    Sometimes you want the user to be able to edit the document and sometimes you don't. Consider what you are looking for.


  • Registered Users Posts: 1,709 ✭✭✭Balfa


    You could also try dbExtra (for simplicity) or DataBeacon (for complexity). Actuate is probably way beyond what you're looking for.

    I think they all have free trials.


  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    ActiveReports is still my favourite reporting solution for hooking into .Net applications (probably cause it was my fave back when I did VB too).


  • Advertisement
Advertisement