By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,682 Members | 1,980 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,682 IT Pros & Developers. It's quick & easy.

CASE STUDY: generating Microsoft Word Documents on a server

MMcCarthy
Expert Mod 10K+
P: 14,534
This problem was proposed to me but not really my area of expertise so I thought I would open it up to the forum to see if anyone had any bright ideas.

The problem is generating Microsoft Word Documents on a server from Word templates and injecting data from a data source. There are a number of solutions to this problem that are less than satisfactory:

1. Use the Microsoft Word Object Model is not good as it requires the installation of a client application on a server and it leaves processes open if you are not really careful.
2. Using WordML is Not great because it's XML and not really word documents.
3. Using HTML is OK but it's HTML not word at the end of the day.
4. Using RTF is same problem.

Requirements:
  1. The documents will be generated on a server, no Word application is installed.
  2. If at all possible the input should be Word documents or Word Template files, so that business users can create them. I will relax this requirement for good alternatives.
  3. The solution should be scalable.
  4. I don't care what technology is used, PHP, Java, .NET?
  5. The solution should work
Oct 5 '07 #1
Share this Question
Share on Google+
20 Replies


Motoma
Expert 2.5K+
P: 3,235
Trying to get someone else to do your job for you, eh Mary?
Oct 5 '07 #2

MMcCarthy
Expert Mod 10K+
P: 14,534
Trying to get someone else to do your job for you, eh Mary?
LOL! Naw ...

This is just something one of my clients proposed to their IT staff. They asked for my input as well.
Oct 5 '07 #3

Motoma
Expert 2.5K+
P: 3,235
Open Office is scriptable; I believe you can set it up to to file conversions without invoking a GUI as you do with MS Office's craptools.
Oct 5 '07 #4

MMcCarthy
Expert Mod 10K+
P: 14,534
Open Office is scriptable; I believe you can set it up to to file conversions without invoking a GUI as you do with MS Office's craptools.
Thats Sun's version of Office is it?
Oct 5 '07 #5

Motoma
Expert 2.5K+
P: 3,235
Thats Sun's version of Office is it?
More or less.
There is OpenOffice, and there is StarOffice, which is Sun's version.
Oct 5 '07 #6

MMcCarthy
Expert Mod 10K+
P: 14,534
More or less.
There is OpenOffice, and there is StarOffice, which is Sun's version.
I remember star office from many years ago but never actually got exposed to open office.
Oct 6 '07 #7

gits
Expert Mod 5K+
P: 5,225
hmmm ...

in case you find a solution based on open office you may be interested in the following odf-to-openXML-converter

kind regards
Oct 7 '07 #8

Motoma
Expert 2.5K+
P: 3,235
hmmm ...

in case you find a solution based on open office you may be interested in the following odf-to-openXML-converter

kind regards
Well, Open Office can save directly to MS Word Document format, as Mary requested.
Oct 7 '07 #9

gits
Expert Mod 5K+
P: 5,225
yep ... forget about my post ... but i thought it could be an good idea to produce odf at all ... because of its standardization. and only convert it for word in case you need to ...

i know that ms is trying to get the office openXML standardized as well and i think this might happen otherwise i think they have to use odf too? ... and isn't openXML the format of word-docs too? sorry ... but i shouldn't had said something in a domain where i'm not an expert ...
Oct 7 '07 #10

MMcCarthy
Expert Mod 10K+
P: 14,534
yep ... forget about my post ... but i thought it could be an good idea to produce odf at all ... because of its standardization. and only convert it for word in case you need to ...

i know that ms is trying to get the office openXML standardized as well and i think this might happen otherwise i think they have to use odf too? ... and isn't openXML the format of word-docs too? sorry ... but i shouldn't had said something in a domain where i'm not an expert ...
This is just a case study gits. All opinions are welcome.
Oct 7 '07 #11

Motoma
Expert 2.5K+
P: 3,235
This is just a case study gits. All opinions are welcome.
As gits stated, there are STANDARDIZED formats which I would strongly urge clients to use. Almost all document editors can utilize these formats, as opposed to proprietary formats. Microsoft is really pushing to get its format to be an ISO standard, however they haven't succeeded with that yet.
Oct 9 '07 #12

MMcCarthy
Expert Mod 10K+
P: 14,534
The client who originally put this problem forward has come up with the following solution.

Apache POI - Java API To Access Microsoft Format Files

Its interesting stuff.
Oct 15 '07 #13

10K+
P: 13,264
The client who originally put this problem forward has come up with the following solution.

Apache POI - Java API To Access Microsoft Format Files

Its interesting stuff.
The integration of the template and the database data would range from being a trivial exercise to very complex depending on the complexity of the reports required.

Might as well throw away everything and use ireports. It's easy to design reports on it and create .jasper files which are easily convertible to .doc and .pdf files. The sql will be tied to the report itself and you can make some complicated reports on it.
We are using ireports a lot at work.

Using the poi with Java is very easy of course but there is no mechanism that ties sql queries to the .docs themselves. You'd have to couple them yourself.
Oct 18 '07 #14

Motoma
Expert 2.5K+
P: 3,235
Crystal Reports can generate word documents too, I believe.
Oct 18 '07 #15

Kabyr
P: 29
If you chose not to install Word on your server, why not install it on a client machine, Use OLE to call it up, do your thing and direct the save path to the server.
Nov 4 '07 #16

alpnz
100+
P: 113
Hi Mary .... I'll have a delve through the linux world ... there are a number of old libraries that could achieve this, or at least managed to convert from word, so surely reversable ... I presume M$SQL pkpk as the data server? although not important ... yes yes I know its been a long time .... my lightship broke down on the return journey ... but I'm back .... :-) xxx
Dec 10 '07 #17

alpnz
100+
P: 113
yep ... forget about my post ... but i thought it could be an good idea to produce odf at all ... because of its standardization. and only convert it for word in case you need to ...

i know that ms is trying to get the office openXML standardized as well and i think this might happen otherwise i think they have to use odf too? ... and isn't openXML the format of word-docs too? sorry ... but i shouldn't had said something in a domain where i'm not an expert ...
M$ have had a small setback with a number of Govts adopting the odf standard ... guess they finally decided to cut the umbilca ...
Dec 10 '07 #18

MMcCarthy
Expert Mod 10K+
P: 14,534
Hi Mary .... I'll have a delve through the linux world ... there are a number of old libraries that could achieve this, or at least managed to convert from word, so surely reversable ... I presume M$SQL pkpk as the data server? although not important ... yes yes I know its been a long time .... my lightship broke down on the return journey ... but I'm back .... :-) xxx
Nice to see you back :)

You should get a new lightship, trying to repair those old models is costly and they are not very reliable.

As to the question in hand. I believe they found a solution but please post any information on libraries as you never know who might find this useful in the future.

Mary
Dec 10 '07 #19

P: 1
We did this by using ODF files as templates, processed them in Django with a library we based on a publicly available code snippet.

The resulting ODF file is then processed with a headless OpenOffice process which runs a customized version of a well-known conversion macro.

Many articles on the web show all kinds of trickery needed to run OpenOffice headless on a server with no X environment, but the Headless VCL plugin available in Debian Etch Backports solved that extremely easily for us.
Feb 6 '08 #20

P: 2
what is u problem.

microsoft word so go create a word obj.

and xml
Feb 14 '08 #21

Post your reply

Sign in to post your reply or Sign up for a free account.