This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes how can i use java to encode a MS-WORD file ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how can i use java to encode a MS-WORD file ?" Watch "how can i use java to encode a MS-WORD file ?" New topic
Author

how can i use java to encode a MS-WORD file ?

liu fred
Greenhorn

Joined: Sep 09, 2001
Posts: 3
hi everyone
i want to encode the file when i click the "SAVE" button in
MS-WORD,how can i catch this event and do something i want to do?
please give me some suggestion
thanks
shashank bapat
Ranch Hand

Joined: Jul 11, 2001
Posts: 69
I m not sure if I got u right
Do u want to
encrypt MS-Word file?
Write something in format understandable to MS Word?
When MS word saves its file u want to intrude and do something ?? what exactly? and why? may be there is another aproach to solve this ... so pl. give more info


-Shashank<BR>MS(CS),BS(CS),SCJP2
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
this sounds something like what you might want to do:
http://forum.java.sun.com/thread.jsp?forum=31&thread=57755
liu fred
Greenhorn

Joined: Sep 09, 2001
Posts: 3
sorry i didn't explain it clearly .
I want to use MS-WORD to edit .doc file , and when pressing
"save" button , i want my java progame (maybe a listening thread) to do something on the file (encode and sent to FTP server ) . So , i need to know how to catch the event to active
my java program .
thanks !
fred
shashank bapat
Ranch Hand

Joined: Jul 11, 2001
Posts: 69
Quick copy paste from the word helpfile:
DocumentBeforeSave Event
Occurs before any open document is saved.
Syntax
Private Sub object_DocumentBeforeSave(ByVal Doc As Document, ByVal SaveAsUI As Boolean, ByVal Cancel As Boolean)
object An object of type Application declared with events in a class module. For more information about using events with the Application object, see Using Events with the Application Object <wohowApplicationEvents.htm>.
Doc The document that's being saved.
SaveAsUI True to display the Save As dialog box.
Cancel False when the event occurs. If the event procedure sets this argument to True, the document isn't saved when the procedure is finished.
----------------
Above is the word basic event that u can handle in VB like language.
I had done some VBA 6 years back since then no touch with M$ stuff so I cannot be to the point but I think u ll have to write some native code which will invoke ur java stuff using jni when it gets this event.
I can see that now they have some ActiveX in there which may make it easy.
[This message has been edited by shashank bapat (edited September 11, 2001).]
shashank bapat
Ranch Hand

Joined: Jul 11, 2001
Posts: 69
Btw, there used to be one function "SendKeys" in old Win SDK. If its still around u can write a word macro for OnSave which will send keystrokes to ur java application which will take necessary action on the recieved keys ... ie encode and upload the file ..primitive form of DDE ... but it did work for me i used it to send keys from MS Access to pagemaker to publish the data in pretty printed page maker file format.
Ugly huh ?? well 6 yrs ago in bombay no one really bothered about cool design and technology involved as long as it worked
All the best
-Shashank
MS(CS),BS(CS),SCJP2
[This message has been edited by shashank bapat (edited September 11, 2001).]
liu fred
Greenhorn

Joined: Sep 09, 2001
Posts: 3
very appreciate
thanks you all
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how can i use java to encode a MS-WORD file ?
 
Similar Threads
MS-Word Docs Access
writing in MS word doc file
File Problem
Can I write in MS Word File from FileOutputStream Constructor
ms-word generation