jQuery in Action, 3rd edition
The moose likes Other Java Products and Servers and the fly likes Regarding making word document in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "Regarding making word document in Java" Watch "Regarding making word document in Java" New topic

Regarding making word document in Java

Kiran Yadav
Ranch Hand

Joined: Nov 02, 2011
Posts: 35

I am trying to generate the customized word document in java. I have used the java files given by "A German software company, called Müller & Stein Software, proposes on its website a free component " metioned at the web site : http://radio.javaranch.com/val/2004/10/16/1097909528000.html

Here, I would like to use different font in the doc file generated.

The source code is:

public class WriteToDoc {
public static void main(String args[]) {
"O'Reilly & \t Associated, Inc.");
WordProcessing.typeTextAtBookmark("AddressLine2", "Mr Miller");
WordProcessing.typeTextAtBookmark("AddressLine3", "101 sssssssssssssMoris Street");
"Sebastopol, CA 95472-9902");
"Sebastopol kkkkkkkkkkk");
WordProcessing.typeTextAtBookmark("Salutation", "Dear Mr Miller ");


So will you please help in this case.
Tim Moores

Joined: Sep 21, 2011
Posts: 2415
That library does not seem to be maintained any more, whereas Apache POI -and its HWPF component- have been updated quite a bit over the last 7 years. While it's possible that WordAPI.exe can do what you're asking, I'd say that it's also worthwhile giving POI another look - which can definitely do that.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

In that case I would change your template so that it uses the font you want. Or perhaps check the documentation to see if setting the font is an option in that software? I don't have access to the site where you got the software from so I can't read it on your behalf.

As for that website which you linked to: it says that Apache POI is not very useful for producing Word documents. This was true in 2004 when the blog entry was written. It's now seven years later and things have changed. You could consider using POI if that software you have there turns out to be a dead end.
Kiran Yadav
Ranch Hand

Joined: Nov 02, 2011
Posts: 35

Thank you all.

POI do works ok with my requirement. Hence moved to POI API.
Thank you for your suggestions.
I agree. Here's the link: http://aspose.com/file-tools
subject: Regarding making word document in Java
It's not a secret anymore!