Save html page as word document by clicking save button

Discussion in 'PHP' started by vaideesh4u, Mar 7, 2009.

  1. #1
    Hi friends,

    I have one save button in my html page and as soon as i click that button the html/static page should be saved with .doc extension.

    As of now i want only the text in the html page to be saved as word document.

    But if possible suggest me for html pages with images too.

    I want the logic or sample source code for the above mentioned requirement.This is urgent.

    cheers,
    Vaideesh4u
     
    vaideesh4u, Mar 7, 2009 IP
  2. SmallPotatoes

    SmallPotatoes Peon

    Messages:
    1,321
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It's not super-simple, but maybe you can find a library somewhere that does it for you. If you can't find one, here's the basic approach:

    - Go into Word and create a simple document with a couple images in it. Save as "Single-file web page".

    - Open that file in a text editor. That will show you the format required. Basically it's a "multipart/related" MIME package with an HTML part for the main document, an XML part with a catalog of the other parts (header/footer, images, etc.).

    - Write some code to parse and wrap your HTML.

    It's just a reverse-engineering exercise; if you haven't done something like this before it will be a good learning experience.
     
    SmallPotatoes, Mar 7, 2009 IP