Generate Word-readable documents with Java?

T

Ten Blade

I'd like to generate a moderately complex document (text, graphics, tables,
bulleted lists) with Java code that can be read by Microsoft Word users.
It's not important to me whether these document is in the traditional
'doc' format or something else like .xml.

I've been researching via Google and there was some buzz about
WordProcessingML several years ago but very little since. POI, which has
been under development for years, is apparently _STILL_ too immature to be
much use.

I've been away from Java for a few years and haven't kept up with most of
it. How are Java developers generating Word-readable documents these days?
I don't want to waste my time learning a technique or technology that was a
fad for a couple of weeks in 2007 and would prefer a well-regarded widely-
used approach if such a beast exists.
 
L

lewbloch

I'd like to generate a moderately complex document (text, graphics, tables,
bulleted lists) with Java code that can be read by Microsoft Word users.
It's not important to me whether these document is in the traditional
'doc' format or something else like .xml.

I've been researching via Google and there was some buzz about
WordProcessingML several years ago but very little since. POI, which has
been under development for years, is apparently _STILL_ too immature to be
much use.

I've been away from Java for a few years and haven't kept up with most of
it. How are Java developers generating Word-readable documents these days?
I don't want to waste my time learning a technique or technology that wasa
fad for a couple of weeks in 2007 and would prefer a well-regarded widely-
used approach if such a beast exists.

1 - Word can read text documents just fine.

POI works great. I don't know why you denigrate it.
http://poi.apache.org/

It's what Java developers are using to generate Word-readable
documents these deays. It's well regarded and widely used.

You can also use the Java interface to Open Office, which creates
ZIPped XML files in ODF (Open Document Format), which I think I heard
Word supports these days.

OO also exports to RTF and .doc formats.
 
S

Stefan Ram

Ten Blade said:
I'd like to generate a moderately complex document (text, graphics, tables,
bulleted lists) with Java code that can be read by Microsoft Word users.
It's not important to me whether these document is in the traditional
'doc' format or something else like .xml.

Untested:

public class Main
{ public static void main( final java.lang.String[] args )
throws java.lang.Throwable
{ final java.io.File outFile = new java.io.File( "example.rtf" );
final java.io.PrintWriter out =
new java.io.PrintWriter( new java.io.FileOutputStream( outFile ), true );
out.println( "{\\rtf1{\\fonttbl{\\f0 Arial;}}\\f0 example\\par}" );
out.close(); }
 
T

Ten Blade

1 - Word can read text documents just fine.

POI works great. I don't know why you denigrate it.
http://poi.apache.org/
I've never used it. But, based on http://poi.apache.org/hwpf/index.html,
POI sounds rather immature so far. For example: "HWPF is still in early
development." And then there was this: "At the moment we unfortunately do
not have someone taking care for HWPF and fostering its development. What
we need is someone to stand up, take this thing under his hood as his
baby and push it forward. Ryan Ackley, who put a lot of effort into HWPF,
is no longer on board, so HWPF is an orphan child waiting to be adopted."

But maybe that information is out-of-date and doesn't reflect the reality
today.
It's what Java developers are using to generate Word-readable
documents these deays. It's well regarded and widely used.
Okay, looks like believing the developer team was not the right thing to
do....
You can also use the Java interface to Open Office, which creates
ZIPped XML files in ODF (Open Document Format), which I think I heard
Word supports these days.

OO also exports to RTF and .doc formats.
I've been messing with OO a bit but couldn't get the "Hello World"
program to work and couldn't get any help on my problem from the OO
forums so I'm inclined to try something different....
 
R

Rhino

(e-mail address removed)-berlin.de (Stefan Ram) wrote in
Ten Blade said:
I'd like to generate a moderately complex document (text, graphics,
tables, bulleted lists) with Java code that can be read by Microsoft
Word users. It's not important to me whether these document is in the
traditional 'doc' format or something else like .xml.

Untested:

public class Main
{ public static void main( final java.lang.String[] args )
throws java.lang.Throwable
{ final java.io.File outFile = new java.io.File( "example.rtf" );
final java.io.PrintWriter out =
new java.io.PrintWriter( new java.io.FileOutputStream( outFile ),
true ); out.println( "{\\rtf1{\\fonttbl{\\f0 Arial;}}\\f0
example\\par}" ); out.close(); }

Good point; I could write RTF documents. Thanks!
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top