Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Fetching Data from database into MS Word

Posted on 2003-11-04
12
Medium Priority
?
530 Views
Last Modified: 2010-04-01
I need to fetch data from database(mysql) and display it in MS word in a formatted way.
Plz suggest how can this be done.
I am using JSP
0
Comment
Question by:ross_123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
  • +1
12 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 9685008
JSP is server side language, i doubt it can integrates with your local word application. However, it's possible to do it, that's using the Mail Merge function available in M$ Word.

First, try export your data into a Header file, or to Access.

Then you can follow the Mail Merge wizards to show your data inside a word document.

This link shows you how to create Mail Merge document:
http://www.mvps.org/word/FAQs/MailMerge/CreateADataSource.htm

Hope this helps
0
 

Author Comment

by:ross_123
ID: 9685032
Can this be done using javascript
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 9685055
>>Can this be done using javascript
No, if you want to display the info on web, you will need to create a page where involved the scripting to format your data. Javascript is no use in this case, and What Mail Merge suggested above will be an 'offline' suggestion.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:ross_123
ID: 9685243
I have provided the user with a button. When he presses that buttonThe data is fetched from the database and shown to him on his machine which he can manipulate in any way he wants.
How can this be done to MS Notepad so that I can transfer it to word using mail merge
thanks
0
 
LVL 15

Expert Comment

by:dualsoul
ID: 9685276
i can suggest you, to create your Word document on server side, and send it back to client, you can build Word document on server in two ways:
  1) use jakarta POI project (avaliable at jakarta.apache.org)
  2) if your server run on Windows and have MSOffice installed, you can write native dll in C++ which will construct Word document, and then use this dll from java, using JNI.

 
0
 
LVL 15

Accepted Solution

by:
jimmack earned 1340 total points
ID: 9685279
I know that you can return a table from a JSP that will be opened by Excel using

<%@ page contentType="application/vnd.ms-excel" %>

Is there an equivalent for word?  eg.

<%@ page contentType="application/vnd.ms-word" %>

It's a bit tricky for me to test.  I use Linux ;-)
0
 

Author Comment

by:ross_123
ID: 9685363
You r right. It works for excel but not for word
0
 

Author Comment

by:ross_123
ID: 9685373
oops sorry
Tried again and its working for word.
But there still remains one problem. It displays the whole table as it is in the word document. But I want to display it in a particular format.
Will that be possible
Thanks for help
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9685396
So the vnd.ms-word works?

Wow.  That was a good guess ;-)

I'm not quite sure what the problem is with the format.  What formatting do you want?
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 9685508
But, despite you can word document in your browser, but how you display the data to the word document? I think it will only works if the document is linked to a data source. Or others have their ideas?

cheers
0
 

Author Comment

by:ross_123
ID: 9685555
thanks a lot
0
 

Author Comment

by:ross_123
ID: 9685575
thanks ryancys.
i am  getting ur point.
What is happening here is that the html table (which is populated with data) is displayed as it is in the word or excel sheet.
Linking word to the data source would be a bit complex , I guess ;)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
On September 18, Experts Exchange launched the first installment of the Help Bell, a new feature for Premium Members, Team Accounts, and Qualified Experts. The Help Bell will serve as an additional tool to help teams increase question visibility.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question