Connecting Tech Pros Worldwide Help | Site Map

creating a word doc using javascript

  #1  
Old December 23rd, 2008, 09:38 AM
Newbie
 
Join Date: Oct 2008
Posts: 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

Tomas
  #2  
Old December 23rd, 2008, 02:29 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,517
Provided Answers: 12

re: creating a word doc using javascript


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.
  #3  
Old December 23rd, 2008, 03:21 PM
Newbie
 
Join Date: Oct 2008
Posts: 29

re: creating a word doc using javascript


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... :(
  #4  
Old December 23rd, 2008, 06:09 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,517
Provided Answers: 12

re: creating a word doc using javascript


If you will be using only IE, look into Meadroid - an ActiveX control to control printing.
  #5  
Old January 19th, 2009, 07:34 AM
Newbie
 
Join Date: Jan 2009
Posts: 5

re: creating a word doc using javascript


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");

Last edited by Dormilich; January 19th, 2009 at 08:02 AM. Reason: added [code] tags
  #6  
Old January 19th, 2009, 08:03 AM
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,485
Provided Answers: 9

re: creating a word doc using javascript


Quote:
Originally Posted by htll View Post
you can convert word to pdf(with java):
unfortunately the request was to use Javascript (that is something totally different to Java).
  #7  
Old January 19th, 2009, 08:59 AM
Newbie
 
Join Date: Jan 2009
Posts: 5

re: creating a word doc using javascript


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.
  #8  
Old January 19th, 2009, 09:38 AM
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,485
Provided Answers: 9

re: creating a word doc using javascript


true, maybe the best option is to use a "print" button which is a) getting the pdf and b) triggering the printing
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call was rejected by callee - buntyindia answers 9 April 22nd, 2008 11:23 AM
Multiple JOINS and duplicates eviephillips answers 2 March 4th, 2008 10:05 AM
VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help gunimpi answers 0 January 10th, 2007 08:55 PM
Creating Word documents on page enak answers 12 November 17th, 2005 11:09 PM