MS word and java on unix/solaris

S

srini_h

Hi All,
Our web application has a requirement to generate MS Word documents
using java on Solaris server. I have seen this topic being discussed at
many places on net, but I found no proper solution. We have tried JACOB
(Java COM bridge), but it works only on windows server. We also need
bi-directional communication between the user and the word document
generated, for example, once the document is generated, the user can
view and make changes to it in the browser itself, and the changes are
to be saved back to the server.
We have searched in many internet forums for this topic, (like
openoffice, JACOB, Using Applet, Servlet communication for
bi-directional communication, POI, iText, javaranch forum etc..) but
still couldnt find a suitable solution which works on Solaris/Unix OS.
Please let me know if anyone has got ideas on this..Any help is
appreciated.

Thanks,
Srini.
 
T

Thomas Weidenfeller

srini_h said:
We have searched in many internet forums for this topic, (like
openoffice, JACOB, Using Applet, Servlet communication for
bi-directional communication, POI, iText, javaranch forum etc..) but
still couldnt find a suitable solution which works on Solaris/Unix OS.
Please let me know if anyone has got ideas on this..Any help is
appreciated.

You have to "thank" Microsoft for this. For a long time they didn't
document their proprietary Word formats at all (there are several). And
what you get today is still very restricted. It takes a lot of bravery
to make sense out of this formats and to implement them. MS has
announced they want to push some Word format through some
standardization, but I doubt that they will disclose every detail and
provide enough information to implement the format.

The only software that can really handle the Word document formats is
Word. And even that one crashes on its own documents sometimes.

If you can, don't deal with the formats on Unix at all. Use some other
one, which is open, and "good enough" to represent your type of
document. Only in the last possible moment import that one into Word on
a Windows machine, and use Word to store it as a Word document. From
that moment on you treat the result as read-only and just store it
somewhere, "never" to be edited on Unix again.

Or shell out money for real Word licenses, and a terminal server
solution, so Unix users can open Word on some remote Windows machine.
Provide access to the Unix home directories via SAMBA on this Windows
machine, so Unix users can see the documents from their home directory
and can edit them.

/Thomas
 
A

Andrea Desole

srini_h said:
Hi All,
Our web application has a requirement to generate MS Word documents
using java on Solaris server. I have seen this topic being discussed at
many places on net, but I found no proper solution. We have tried JACOB
(Java COM bridge), but it works only on windows server. We also need
bi-directional communication between the user and the word document
generated, for example, once the document is generated, the user can
view and make changes to it in the browser itself, and the changes are
to be saved back to the server.
We have searched in many internet forums for this topic, (like
openoffice, JACOB, Using Applet, Servlet communication for
bi-directional communication, POI, iText, javaranch forum etc..) but
still couldnt find a suitable solution which works on Solaris/Unix OS.
Please let me know if anyone has got ideas on this..Any help is
appreciated.

I can understand it if POI is not a suitable solution (low
compatibility), but it should work on solaris. I think I used it a while
ago to generate excel files.
POI should be fine, specially if you don't have to make complex stuff.
 
A

Alex

the user can
view and make changes to it in the browser itself, and the changes are
to be saved back to the server.
Suggestion: use rtf format. It's Word's native and easy. And could be
easily transformed to web.
I don't know this format and how to do it. But I'm sure it's pretty
easy.
Alex.
 
E

Erik Andreas Brandstadmoen

Andrea said:
I can understand it if POI is not a suitable solution (low
compatibility), but it should work on solaris. I think I used it a while
ago to generate excel files.
POI should be fine, specially if you don't have to make complex stuff.

I second using POI. I'm using it now on a Java project to replace a
prototype using Python and COM for Excel files, and it works fine. And
it seems much faster than using COM, although I can't verify this until
I have actually finished writing the application in Java (or benchmarked
it, but this app is too small to use time on benchmarking).

I think, at least the Excel part of POI (called HFFS) is very promising.
You should at least consider it, since you have rather exotic
requirements (being able to produce native MS Word on Solaris), if you
don't want to put up a Win box just for this purpose.

Looks like the POI Word API is called HWPF, and only supports Word 97,
but this doesn't matter, right, since you're only writing them.

http://jakarta.apache.org/poi/hwpf/index.html

Good luck!

Regards, Erik Brandstadmoen.
 
A

AbhayN

Hi,

Microsoft has published XML Schema for its Word Documents. Its called
WordprocessingML

What you could do is,
1. Create a Word Document in MS Word
2. Save it as Doc1.xml
3. Cut out parts like tables, sections, that will be generally
repeated
4. Write Java Code to fill in the data at appropriate places in the xml
file
thereby creating XML with appropriate data.
5. Join the XML pieces into one MS Document
6. Change extension of file to Doc1.doc

Its a Lengthy Method [A real headache]. The catch is that the
Document can open only in
MS Word 2003 for the First Time and the Save Button must be Clicked for
it to open in older versions of MS Word.

I hope this helps.

Regards,
Abhay
 
S

srini_h

Hi all,
Thanks for the replies. First of all, we have ruled out
Apache's POI for word document processing (HWPF) as it is not fully
mature and secondly, we have considered WordprocessingML already, but
the issue is that most of our users use Word 2000 or 2002. The XML
format is not compatible with all versions of word.And also we need
bi-directional communication, i.e. when the user saves in the browser,
the document shall be saved on to server. Please let me know if you
have got any more ideas. I appreciate your responses so far.

Thanks
Srini
 
R

Roedy Green

Thanks for the replies. First of all, we have ruled out
Apache's POI for word document processing (HWPF) as it is not fully
mature and secondly, we have considered WordprocessingML already, but
the issue is that most of our users use Word 2000 or 2002. The XML
format is not compatible with all versions of word.And also we need
bi-directional communication, i.e. when the user saves in the browser,
the document shall be saved on to server. Please let me know if you
have got any more ideas. I appreciate your responses so far.

One thing you might be a be able to do is run word with exec or
through some sort of COM JNI. You could then get a copy of puppet-run
Word to upgrade old documents to new word format and from there to XML
or RTF. Licensing might get you in trouble to provide such a service
on a server though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top