• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

converting and saving word document

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
prabhatis
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
reply
    Bookmark Topic Watch Topic
  • New Topic