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

creating a word doc using javascript

P: 29
Hi y'all

I've been trying to print a book with articles straight from the database.
Each page has 2 articles with a picture, more info and it's subarticles.
I want to have an index table and the pages should be numbered.

When they click on a button on the website, this document should be printed.
If i use for example a PDF, or send it straight to the printer, well, then I don't have the markup (page numbers, index table, sometimes only one article on one page (too much subarticles for example))

MS Word would do the markup automatically.
right now i'm 'playing' with the word ocx to obtain this.

I've been searching for the right activeX component, but can't find the perfect one.

Anybody can help me with my search? or provide other options (maybe some options I don't know about)

Thanks i advance

Dec 23 '08 #1
Share this Question
Share on Google+
7 Replies

Expert Mod 15k+
P: 16,027
Are you using IE only? If not, I would suggest using a print stylesheet where you can control how the page is printed. See A List Apart: Articles: CSS Design: Going to Print and Print Stylesheets - css-discuss.
Dec 23 '08 #2

P: 29
I checked into this possibility, but it didn't seem the right thing to do because I can't know how many items can be printed on one page.
Only word formats them in pages and has a correct index table.

This explanation was quite interesting:
Paged media

But it's CSS21, and I will be only using Internet Explorer.
Some might still use ie 5.0... :(
Dec 23 '08 #3

Expert Mod 15k+
P: 16,027
If you will be using only IE, look into Meadroid - an ActiveX control to control printing.
Dec 23 '08 #4

P: 5
you can convert word to pdf(with java):
Expand|Select|Wrap|Line Numbers
  1. import officetools.OfficeFile;
  2. FileInputStream fis = new FileInputStream(new File("test.doc"));
  3. FileOutputStream fos = new FileOutputStream(new File("test.pdf"));
  4. OfficeFile f = new OfficeFile(fis,"localhost","8100", false);
  5. f.convert(fos,"pdf");
Jan 19 '09 #5

Expert Mod 5K+
P: 8,639
unfortunately the request was to use Javascript (that is something totally different to Java).
Jan 19 '09 #6

P: 5
Yes, but JavaScript takes action in the browser only, so it can not touch MS Word files.
All he can do is to convert to pdf BEFORE sending the pdf to the visitor's browser.
Jan 19 '09 #7

Expert Mod 5K+
P: 8,639
true, maybe the best option is to use a "print" button which is a) getting the pdf and b) triggering the printing
Jan 19 '09 #8

Post your reply

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