creating a word doc using javascript 
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
| 
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... :(
| 
December 23rd, 2008, 06:09 PM
|  | 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.
| 
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): - import officetools.OfficeFile;
-
FileInputStream fis = new FileInputStream(new File("test.doc"));
-
FileOutputStream fos = new FileOutputStream(new File("test.pdf"));
-
OfficeFile f = new OfficeFile(fis,"localhost","8100", false);
-
f.convert(fos,"pdf");
Last edited by Dormilich; January 19th, 2009 at 08:02 AM.
Reason: added [code] tags
| 
January 19th, 2009, 08:03 AM
|  | 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 you can convert word to pdf(with java): | unfortunately the request was to use Javascript (that is something totally different to Java).
| 
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.
| 
January 19th, 2009, 09:38 AM
|  | 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
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,662 network members.
|