creating a word doc using javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tomaz
    New Member
    • Oct 2008
    • 29

    creating a word doc using javascript

    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
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    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.

    Comment

    • tomaz
      New Member
      • Oct 2008
      • 29

      #3
      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... :(

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        If you will be using only IE, look into Meadroid - an ActiveX control to control printing.

        Comment

        • htll
          New Member
          • Jan 2009
          • 5

          #5
          sol

          you can convert word to pdf(with java):
          Code:
          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; Jan 19 '09, 08:02 AM. Reason: added [code] tags

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            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).

            Comment

            • htll
              New Member
              • Jan 2009
              • 5

              #7
              ..

              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.

              Comment

              • Dormilich
                Recognized Expert Expert
                • Aug 2008
                • 8694

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

                Comment

                Working...