hi
can u please tell me how to convert html page into word document so tat the user can download the page in html format

Recommended Answers

All 5 Replies

hi
can u please tell me how to convert html page into word document so tat the user can download the page in html format

Do you mean convert a word doc into HTML? Thats the only way they can download it in HTML.

sorry i want the user to download in doc format.

sorry i want the user to download in doc format.

I believe there is quite a bit of difference in the encoding of different versions of MS .doc files. If you want to write this with just PHP, you'll have to find available documentation on the .doc formats.

I believe the latest .doc formats use an XML format, so it should be the easiest to go with.

If you want another application to do the work for you, you can invoke that application from the command line. A good application would be openoffice writer, though there may be applications specifically developed for conversions between .doc formats. If you really want to pursue it you can look at the source code for Open Office and see how it does the conversions.
http://download.openoffice.org/2.1.0/source.html

To execute a shell command in PHP use the exec(), or system() functions or a similar alternative to those two.

I prefer to create a pdf version instead of word since pdf format works the same.

A simpler way to do it is to duplicate the HTML file in Microsoft Word and save the file as a .doc extension. Upload the .doc file to your server. Put a Hyperlink on your HTML file pointing to the .doc file. A user can download it by just clicking the link. It works fine for me here, by just clicking the "Download User Guide" button.

hi
can u please tell me how to convert html page into word document so tat the user can download the page in html format

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.