Forum Moderators: open

Message Too Old, No Replies

Saving contents of TextArea to a word doc

         

pallavr

6:25 am on Nov 17, 2006 (gmt 0)

10+ Year Member



Hi All,

After lot of hits and misses i have turned to this forum.
I have a very simple JSF Portlet.
It has a simple textarea and two buttons.(Print and Save As).
On the click of the Save button i want the contents of the TextArea to be save to as a Word Doc.

The approach i tried using is :
popup.document.execCommand("SaveAs",true,"Default.doc");

But it has two disadvantages:
a)When the "Save Dialog" appears the "Save as type" by default is "html or text" but not "Word Document".

How can i convert the contents of html in textarea to purely word format?

b) Second exceCommand() it supported only by IE but not other browsers.
Please suggest me how could i make it support other browsers.

Are the above mentioned actions supported by JavaScript.
I am eagerly waiting for your suggestions.

Best Regards,
Pals.

penders

1:14 pm on Nov 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi pallavr

a) I'm not sure that you can save to Word format (client side) without some kind of browser plugin / ActiveX / Java component installed on the client? Or maybe you can have a server-side plugin that will create the Word Doc and allow the client to download it?

b) I think Mozilla supports execCommand() - but not quite the same as IE, and I don't think you can 'SAVE' files locally?
[mozilla.org...]

c) welcome to WebmasterWorld!

pallavr

8:37 am on Nov 20, 2006 (gmt 0)

10+ Year Member



Hi penders,

Thank you for your valuable suggestions
I am trying to use a JSP or servlet to convert the JSF page contents to rich text format.
Haven't struck much luck but net suggests that as the best option.

Best Regards,
Pallavi