Writing to Word documents

  • Thread starter Jonck van der Kogel
  • Start date
J

Jonck van der Kogel

Hi everybody,
I have defined a Word template and set bookmarks at certain locations
in this document, to which I then want to write text gotten from a
database and save the file. In this way I could create standard
documents (for example an invoice) in an automated manner.
I have looked into the Jakarta POI project
(http://jakarta.apache.org/poi/index.html), but this project is mostly
aimed at Excel, Word support is still in its infancy.
Another solution that I've found
(http://www.must.de/en/default.html?../Javactpe.htm) seems to work
very well, but is Windows only.
Also there are a few commercial solutions, but these cost several
thousand dollars, which I can't afford.

I figure such an automated creation of Word documents is probably
being done by a lot of people, so therefore I was wondering, does
anyone know of a (affordable) way to achieve what I described in a
platform independent manner?

Thanks very much, Jonck
 
S

Sudsy

Jonck van der Kogel wrote:
I figure such an automated creation of Word documents is probably
being done by a lot of people, so therefore I was wondering, does
anyone know of a (affordable) way to achieve what I described in a
platform independent manner?

As I've tried to explain to many potential employers, you're not
likely to find people equally adept at both .NET and Java.
Similarly, NT Server and Linux administration experience tends to
be mutually exclusive; if you're truly expert at one then you're
not likely to be as proficient in the other. Very different mind-
sets, although exceptions do exist.
To address your specific issue, Microsoft® controls the
format of documents created/used by their products. They don't
make the inside information available unless you're a major
customer (read: BIG$) and sign an onerous NDA. So don't expect
someone who has made the huge investment in time and effort to
decode the formats to provide the fruits of their labour without
charge.
There ARE alternatives to proprietary formats, BTW. Those of us
seeking portability will typically choose one of those rather
than be tethered to a capricious vendor.
As always, YMMV.
 
A

Andrew Thompson

On 14 Nov 2004 15:14:53 -0800, Jonck van der Kogel wrote:

(based on the assumption you've already read Sudsy's comments)
I have defined a Word template and set bookmarks at certain locations
in this document, to which I then want to write text gotten from a
database and save the file. In this way I could create standard
documents (for example an invoice) in an automated manner.

Use HTML for your invoices. It makes a lot more sense.
 
S

Sebastian Millies

A platform-independent solution would be possible only by directly
manipulating the MS Word document format. Bad idea - it is not
publicly documented, and many details may change from version to
version.

So you'll be stuck with some kind of a Java-COM bridge, which
of course, is supported only on the Windows platform. There are
open source "products" e.g. Jacob, and commercial ones.
I've worked with Jacob and had reasonable success. However, I'd
much prefer persuading the customer to use a different document
format (HTML, PDF, ...).

-- Sebastian
 
L

Lesley

Sebastian Millies said:
A platform-independent solution would be possible only by directly
manipulating the MS Word document format. Bad idea - it is not
publicly documented, and many details may change from version to
version.

So you'll be stuck with some kind of a Java-COM bridge, which
of course, is supported only on the Windows platform. There are
open source "products" e.g. Jacob, and commercial ones.
I've worked with Jacob and had reasonable success. However, I'd
much prefer persuading the customer to use a different document
format (HTML, PDF, ...).

-- Sebastian

I agree that the OP will have problems trying to 'tweak' a Word
document from a Java program. The file format does change with MS
products, hence the probably long forgotten scenario with an update to
the Word package where it meant that previous Word documents could not
actually be read by the new version!

I'd agree that HTML is a reasoanbly platform independent option but
may display differently in different browsers. Whether you can tweak
the HTML output of a Word document is another matter. Other than that
take a look at OpenOffice and the way it handles document format and
structure?

Regards

LesleyB
 
Y

Y2KYZFR1

Hi everybody,
I have defined a Word template and set bookmarks at certain locations
in this document, to which I then want to write text gotten from a
database and save the file. In this way I could create standard
documents (for example an invoice) in an automated manner.
I have looked into the Jakarta POI project
(http://jakarta.apache.org/poi/index.html), but this project is mostly
aimed at Excel, Word support is still in its infancy.
Another solution that I've found
(http://www.must.de/en/default.html?../Javactpe.htm) seems to work
very well, but is Windows only.
Also there are a few commercial solutions, but these cost several
thousand dollars, which I can't afford.

I figure such an automated creation of Word documents is probably
being done by a lot of people, so therefore I was wondering, does
anyone know of a (affordable) way to achieve what I described in a
platform independent manner?

Thanks very much, Jonck

write to an RTF format, that will open right up in word, or html,
either one can be imported into word by clueless users with no
problems. RTF is probably the best becuase its extension is mapped to
word by default
 
A

Ann

Y2KYZFR1 said:
(e-mail address removed) (Jonck van der Kogel) wrote in message

write to an RTF format, that will open right up in word, or html,
either one can be imported into word by clueless users with no
problems. RTF is probably the best becuase its extension is mapped to
word by default

Yesterday I viewed a microsoft web page that discussed problems
with upgrading to WIN XP SP2 and there was a statement that the
RTF converters were being unlinked or something such that each
program was itself now (in SP2) responsible for the conversion. I got the
impression that RTF was being phased out. I don't have the URL
because I cleaned out my cache/history.
 
A

Andrew Thompson

...RTF is probably the best becuase its extension is mapped to
word by default

Not on my XP Pro box it isn't, .RTF open in Wordpad as default.
(But that would not hamper it for the OP's users - who
probably have MS Office, or at least MS Word, installed).
 
S

steve

Hi everybody,
I have defined a Word template and set bookmarks at certain locations
in this document, to which I then want to write text gotten from a
database and save the file. In this way I could create standard
documents (for example an invoice) in an automated manner.
I have looked into the Jakarta POI project
(http://jakarta.apache.org/poi/index.html), but this project is mostly
aimed at Excel, Word support is still in its infancy.
Another solution that I've found
(http://www.must.de/en/default.html?../Javactpe.htm) seems to work
very well, but is Windows only.
Also there are a few commercial solutions, but these cost several
thousand dollars, which I can't afford.

I figure such an automated creation of Word documents is probably
being done by a lot of people, so therefore I was wondering, does
anyone know of a (affordable) way to achieve what I described in a
platform independent manner?

Thanks very much, Jonck

don't bother screwing about, write the document directly to p.d.f format.

there is itext , which you can find on sourceforge.
tie that into jasperreports , for your layouts
 
A

Ann

steve said:
don't bother screwing about, write the document directly to p.d.f format.

there is itext , which you can find on sourceforge.
tie that into jasperreports , for your layouts

For Windows XP, I set up a postscript printer (that I don't
physically have) and use it to print to a 'ps' file. Then I use Adobe
to convert (distiller) to PDF. Works great with any application
that can print to a printer.
 
E

Edwin van der Sanden

Hi everybody,
I have defined a Word template and set bookmarks at certain locations
in this document, to which I then want to write text gotten from a
database and save the file. In this way I could create standard
documents (for example an invoice) in an automated manner.
I have looked into the Jakarta POI project
(http://jakarta.apache.org/poi/index.html), but this project is mostly
aimed at Excel, Word support is still in its infancy.
Another solution that I've found
(http://www.must.de/en/default.html?../Javactpe.htm) seems to work
very well, but is Windows only.
Also there are a few commercial solutions, but these cost several
thousand dollars, which I can't afford.

I figure such an automated creation of Word documents is probably
being done by a lot of people, so therefore I was wondering, does
anyone know of a (affordable) way to achieve what I described in a
platform independent manner?

Thanks very much, Jonck
you might want to have a look at WordprocessingML :
http://rep.oio.dk/Microsoft.com/officeschemas/welcome.htm

hth,
Edwin.
 
Joined
Apr 6, 2009
Messages
1
Reaction score
0
Exporting reports from JasperReports in Excel, Word and PowerPoint formats

Aspose is also offering some products for JasperReports developers to export their reports in PowerPoint (PPT, PPS) and Word document (DOC, DOCX, HTML and TXT) formats. Another export format Excel (XLS) is about to be supported in near future.

Hope you will find this information helpful.
 

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,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top