Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Reporting from ASP/MySQL to MS Word
Old 12-01-2010, 01:21 PM Reporting from ASP/MySQL to MS Word
Junior Talker

Posts: 3
Name: Danian
Trades: 0
All,
Hope you can help or advise.
I currently have an asp web based application that uses a MySQL database backend. Everything is working perfectly except we now want to produce document reports. We have clients that have yearly contracts, so when they renew their contract we want to be able to press a button on the webpage and it opens MS Word and prints off the contract. I say MS Word as our contracts are currently in this format. However I am happy to listen to better suggestions of ways or applications that could do this if better. I have created views in MySQL and they work fine with all the information, its just the button part that I can't get my head around. To be honest it would be better if MS Word does not launch and the print out just comes out...
Also, if possible and if we continue to use MS Word, is it possible to write back to the MySQL database that if you print the document that it can write to one of the tables to say so? If so how is this done?
Thanks for your help,
D
danian is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-01-2010, 03:08 PM Re: Reporting from ASP/MySQL to MS Word
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,336
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
You can't "launch" a clientside application such a Word from ASP.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-01-2010, 03:12 PM Re: Reporting from ASP/MySQL to MS Word
Junior Talker

Posts: 3
Name: Danian
Trades: 0
chrishirst

How would you suggest that i can create a report and run it from the app?

The application is running on a local machine and is not based on the internet.
danian is offline
Reply With Quote
View Public Profile
 
Old 12-01-2010, 03:20 PM Re: Reporting from ASP/MySQL to MS Word
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,336
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
I'd suggest reading up on the Open XML format and output the reports in XML.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-01-2010, 03:28 PM Re: Reporting from ASP/MySQL to MS Word
Junior Talker

Posts: 3
Name: Danian
Trades: 0
OK,

I am new to XML and not used it before, can you advise a how it could work from clicking the button to the document being printed. Also when the document prints can it then write back to a tabke in the database to say that it has printed?
danian is offline
Reply With Quote
View Public Profile
 
Old 12-01-2010, 03:58 PM Re: Reporting from ASP/MySQL to MS Word
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,336
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
You can't print from asp either, you would need to write the XML and stream it out to the useragent/browser with an appropriate content header and rely on the MIME type to open the "helper application" from the browser.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-21-2010, 02:21 AM Re: Reporting from ASP/MySQL to MS Word
Banned

Posts: 2
Name: andraljacob
Trades: 0
I currently have an ASP web-based application that uses a MySQL database backend. ASP.NET Report Maker is a powerful reporting tool that supports Microsoft Access Database or any data source that can generate buzz dynamic ASP.NET Web reports.
andraljacob is offline
Reply With Quote
View Public Profile
 
Old 12-28-2010, 02:15 PM Re: Reporting from ASP/MySQL to MS Word
Novice Talker

Posts: 5
Name: Carl
Trades: 0
I have outputted 'Word'/Excel files in many ASP systems (including as receipts for a ECommerce system), it is a simply addition of two lines of code and works cross browser and OS's.
If you make up your page as you wish for it to be, keep in mind an A4 page is 600 pixels wide and that you will not be able to link to a stylesheet, so all css needs to be set in the page.
If you need images I would recommend using full url path, rather then a relative path.
Once you have viewed the page and are happy with how it looks, go into the page, and within the top of the page, before your HTML, and within ASP tags, add the following two lines
///
Response.AddHeader "Content-Disposition","attachment;filename=filename.doc"
Response.ContentType = "application/vnd.ms-word"
///
Replace 'filename' with whatever you wish to call the file, you can even give it a date, just close the speech marks and then use + between the date coding.
For example: "attachment;filename=report1-"+ISOSDate+".doc"
This would set the date via an external code and then place it dynamically as the page is created.
You can also make the filename dynamic, there are a lot of options.

For printing and logging, whilst you cannot force it to open Word, this will just generate a Save/Open dialog box in IE, a Save in other browsers.
You can place a button that links to this page which submits code on click to update your database. Alternatively you could use Javascript to call the browser inbuilt 'Print' option and combine it with calling this page, although without trying it, I would not be 100% sure if it would all work together.

If you did need to record it had been printed, you could look at a link the customer clicks after printing, to record the fact, linked to a simple update/insert script, depending on your database setup.

If you were only interested in Printing the document, you could simply generate a page laid out as the document, and then call Print via JS via a link and also then provide a downloaded version for the customer to save. This would give you a reasonably easy way to then record the file had been called and send to print, of course you can never 100% be sure it printed without the interaction of the user.

And of course, do not forget you can create a file with 'File Object', which would create a file and save it to the server, allowing you to make it available to save/open/print or email etc.
This is always handy when you want to email a file as it will save it to the server, where as the above code simply generates a Word version for Saving, the file itself does not actually exist as a Word document per sa.

I hope that helps, do feel free to send me a message if you would like anything clarifying.
CGW3 is offline
Reply With Quote
View Public Profile
 
Old 12-28-2010, 02:18 PM Re: Reporting from ASP/MySQL to MS Word
Novice Talker

Posts: 5
Name: Carl
Trades: 0
If you are not familiar with a print function for your website, check out a quick tutorial online, such as http://www.htmlgoodies.com/beyond/ja...JavaScript.htm or just Google it.
It is really only calling the Print function within your browser with Javascript, an old one, but can be useful when you want to provide a function such as you are interested in, logging when a document is printed.
CGW3 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Reporting from ASP/MySQL to MS Word
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.29161 seconds with 12 queries