Saving only a portion of webpage into a file
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Saturday, April 29, 2006 08:01 AM

hello, im working on a web application that generates dynamic data. My question is: i want users to be able to save the generated data, but not the whole web page, just a table in the web page that holds this data. I searched and found out that showing a "save as" dialog box is possible with javascript, with a method like: onclick="javascript: document.execCommand('SaveAs','1',null);. However, i coulnd't find out how to change the document object (or is it possible?) or a trick to print just the table of dynamic data. I tried to cover the table with and use onclick="javascript: myData.execCommand('SaveAs','1',null); but as you might guess, it didn't work and gave this error message: "object doent support this propert   More>>

hello,

im working on a web application that generates dynamic data. My question is: i want users to be able to save the generated data, but not the whole web page, just a table in the web page that holds this data. I searched and found out that showing a "save as" dialog box is possible with javascript, with a method like: onclick="javascript: document.execCommand('SaveAs','1',null);. However, i coulnd't find out how to change the document object (or is it possible?) or a trick to print just the table of dynamic data. I tried to cover the table with

and use onclick="javascript: myData.execCommand('SaveAs','1',null); but as you might guess, it didn't work and gave this error message: "object doent support this property or method". Indeed i dont have any idea what div tag can and can't do, so it was just a meaningless try. By the way, i want to add that i can't use iframes just because of program design issues.
Anyway, do you have any suggestions?



thanks in advance,
ibrahim saygýlý    <<Less

Re: Saving only a portion of webpage into a file

Posted By:   Christopher_Koenigsberg  
Posted On:   Sunday, May 7, 2006 09:28 AM

add a button to your page, labelled something like "save data" or "download" or "export" etc.,



When you generate the data, save it in session scope.



Have the "save" button invoke the url of something (servlet, Struts Action, Spring/JSF component etc.) that will take the data, from the session scope, and write it to the response, in a format suitable for saving (CSV, etc.).
About | Sitemap | Contact