Hello,

 

               We're looking into the possibility of using POI to
generate some reports in word format.  The template for these reports
has a table of contents and a background image.  Just as a first simple
test, I used POI to read the template in and then immediately write it
back out, without any modification.  This is the code I used (modified
from what already existed in HWPFDocument.java):

 

/**

   * Takes two arguments, 1) name of the Word file to read in 2)
location to

   * write it out at.

   * @param args

   */

  public static void main(String[] args)

  {

    try

    {

      HWPFDocument doc = new HWPFDocument(new FileInputStream(args[0]));

      OutputStream out = new FileOutputStream(args[1]);

      doc.write(out);

      out.flush();

      out.close();

    }

    catch (Throwable t)

    {

      t.printStackTrace();

    }

  }

 

 

The output is mostly correct, but the background image in the template
comes across as a large red "X", the table of contents is missing and
the subsequent sections aren't numbered as they should be.  Are there
features that POI just hasn't addressed yet, or is there something else
I need to be doing?  Any insight anyone has would be appreciated.
Thanks.

 

Brandon

 

Reply via email to