Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

MS word and java on unix/solaris

Thread view: 
srini_h - 17 Jan 2006 15:09 GMT
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.
Thomas Weidenfeller - 17 Jan 2006 16:00 GMT
> 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
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

Andrea Desole - 17 Jan 2006 16:31 GMT
> Hi All,
> Our web application has a requirement to generate MS Word documents
[quoted text clipped - 11 lines]
> 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.
Erik Andreas Brandstadmoen - 17 Jan 2006 22:12 GMT
> 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.
Alex - 17 Jan 2006 19:19 GMT
>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.
AbhayN - 19 Jan 2006 09:07 GMT
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
srini_h - 19 Jan 2006 15:02 GMT
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
Roedy Green - 19 Jan 2006 17:20 GMT
> Thanks for the replies. First of all, we have ruled out
>Apache's POI for word document processing (HWPF) as it is not fully
[quoted text clipped - 4 lines]
>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.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.