Generate Word-readable documents with Java?

Discussion in 'Java' started by Ten Blade, Jul 12, 2011.

  1. Ten Blade

    Ten Blade Guest

    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.


    --
    Ten-Blade
    Ten Blade, Jul 12, 2011
    #1
    1. Advertising

  2. Ten Blade

    lewbloch Guest

    On Jul 12, 3:59 pm, Ten Blade <> wrote:
    > 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.

    --
    Lew
    lewbloch, Jul 13, 2011
    #2
    1. Advertising

  3. Ten Blade

    Stefan Ram Guest

    Ten Blade <> writes:
    >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(); }
    Stefan Ram, Jul 13, 2011
    #3
  4. Ten Blade

    Ten Blade Guest

    lewbloch <> wrote in
    news::

    > On Jul 12, 3:59 pm, Ten Blade <> wrote:
    >> I'd like to generate a moderately complex document (text, graphics,
    >> table

    > s,
    >> 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 b

    > e
    >> 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.
    >>

    >
    > 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....

    > --
    > Lew
    >






    --
    Ten-Blade
    Ten Blade, Jul 13, 2011
    #4
  5. Ten Blade

    Rhino Guest

    -berlin.de (Stefan Ram) wrote in
    news:-berlin.de:

    > Ten Blade <> writes:
    >>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!

    --
    Rhino
    Rhino, Jul 13, 2011
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    5,941
    =?ISO-8859-1?Q?S=E9bastien_Auvray?=
    Feb 16, 2005
  2. Replies:
    1
    Views:
    471
    Juan T. Llibre
    Oct 18, 2006
  3. Replies:
    15
    Views:
    920
  4. Thibaut Barrère
    Replies:
    5
    Views:
    156
    Thibaut Barrère
    Dec 31, 2008
  5. Tony
    Replies:
    2
    Views:
    376
Loading...

Share This Page