aspose file tools*
The moose likes Servlets and the fly likes converting and saving word document Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "converting and saving word document " Watch "converting and saving word document " New topic
Author

converting and saving word document

prabhatis
Greenhorn

Joined: Apr 07, 2001
Posts: 18
there r two problems i am facing ..
1.converting word documents to html using java api
2.saving word documents in internet explorer.
internet explorer ha built in capability to open word documents.
but if i want to save them then is there any way to do that beside using the browser file/save as.
i use jsp/servlets to get the word documents from the oracle database.

thanx in advance.
PRabhat kumar
Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
Hi,
If you have used the sqlj.runtime.* package provide by Oracle, it has some custom classes to do exactly, what you want to do.
I suppose, you might be storing the Word file as LONG,LONGRAW,BLOB or CLOB objects.
Assuming that you are using LONGRAW datatype of Oracle DB, and you are having a some.doc to save the changes, you would do it in this way

Hope this helps,
Regards,

------------------
Sandeep Desai
vgdesai@vsnl.com

  1. Sun Certified Java Programmer Scored 93 per cent
  2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
  3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
  4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56

  5. [This message has been edited by Desai Sandeep (edited April 07, 2001).]


<b>Sandeep</b> <br /> <br /><b>Sun Certified Programmer for Java 2 Platform</b><br /> <br /><b>Oracle Certified Solution Developer - JDeveloper</b><br /><b>-- Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java </b><br /><b>-- Object-Oriented Analysis and Design with UML</b><br /> <br /><b>Oracle Certified Enterprise Developer - Oracle Internet Platform</b><br /><b>-- Enterprise Connectivity with J2EE </b><br /><b>-- Enterprise Development on the Oracle Internet Platform </b>
prabhatis
Greenhorn

Joined: Apr 07, 2001
Posts: 18
hi sandeep,
i know how to extract and update BLOB fields in database.
my problem is ..
is there any way to have the functionality of saving word documents in browser itself? i mean accessing the properties of word document object that is displayed in the browser. that's it.
Ruslan Ivanov
Ranch Hand

Joined: Feb 22, 2001
Posts: 72
you probably can by accsessing the COM that word provides you can gain access to it. But i am clueless how you can do it.
Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
prabhatis,
Are you looking for a functionality on the browser to provide "Sava as.." feature for you?
For instance, Visual Age for Java online help, provides you an option to read in HTML format or PDF format.When you click on the PDF format, IE5.5 opens up the PDF file in the browser application itself.There you have the whole set of tools including the "Save" option.
I suppose, this sort of a feature needs to be built into the browser.I haven't come across any browser, which provides the facility to open DOC files (and hence save the DOC files!!) in the browser itself.
This looks to be an interesting topic
Will try to do some more research on this.Will post a message here in case, I find out something positive.
Regards,


------------------
Sandeep Desai
vgdesai@vsnl.com

  1. Sun Certified Java Programmer Scored 93 per cent
  2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
  3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
  4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56
prabhatis
Greenhorn

Joined: Apr 07, 2001
Posts: 18
hi .
just for information .. true for machines with ie5.0 or more and word97 or more installed.
u can get it opened in the browser itself
and can be able to edit it there itself.
i have tried to read the word file but till now only able to read the text only unfortunately ..
i'd appreciate any help in this regard ..
PRabhat kumar (Prabhatis)
Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
Hi Prabhat,
Yes, you are right.You can open MS-Word docs in IE 5.0+ browsers.
I think, your problem would be solved if you could open/read a document in other browsers like Netscape.
I tried opening a PDF file in the browser itself.For that you need to copy the DLL file (nppdf32.dll) to the Netscape Plugin directory.I was looking for a similar sort of a plug-in for DOC files, but was unable to find it till now.
However, the immediate option, which I can think of right, is to look out for some converters, which are able to convert the DOC file to HTML and vice-versa.One such site that I came across is http://www.wwware.com .
I am looking to do this sort of conversion for any kind of document in Java.Let me know, if you happen to find/develop such tools.
Hope this helps
Regards,

------------------
Sandeep Desai
vgdesai@vsnl.com

  1. Sun Certified Java Programmer Scored 93 per cent
  2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
  3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
  4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56

  5. [This message has been edited by Desai Sandeep (edited April 10, 2001).]
    [This message has been edited by Desai Sandeep (edited April 10, 2001).]
prabhatis
Greenhorn

Joined: Apr 07, 2001
Posts: 18
this code works for reading only text from the doc files
import java.io.*;
class test{
static void main(String args[]){
try{
DataInputStream fin=new DataInputStream(new FileInputStream("test.doc"));
DataOutputStream fout=new DataOutputStream(new FileOutputStream("test2.doc"));
int c=fin.read();
while (c!= -1){
//System.out.println(c);
fout.writeByte(c);
c=fin.read();
}
fin.close();
fout.close();
}
i think by using JNI i might be able to read and save word docs ..but i don't how to get handle of word OLE object using JNI
or go forward .
help in this regard is required
catch(Exception e){
}
}
}
Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
Hi,
I havenot worked on JNI, so I will not be able to comment on this.
However, I still feel that the process of getting this could be achieved if

  • The browser can understand the DOC MIME TYPE
  • We are able to write in a proper format to the response stream of the client

  • Alternatives could be, to write a Java Application which converts DOC files to HTML files and vice-versa.I personally feel this may not be a bad option, as all the browsers supports HTML.
    Regards,

    ------------------
    Sandeep Desai
    vgdesai@vsnl.com

    1. Sun Certified Java Programmer Scored 93 per cent
    2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
    3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
    4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56
prabhat kumar
Ranch Hand

Joined: Apr 11, 2001
Posts: 114
me either feel in tha same direction .ie convertion of doc to html but i do not see light ..
however i am working on this ..will keep u informed
Prabhat kumar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: converting and saving word document