0

How can I create word document and add certain elements inside so it can be downloaded or sent by an email?

What can you suggest me? Some examples? Is this doable with JavaScript or PHP?

user123_456
  • 5,635
  • 26
  • 84
  • 140
  • possible duplicate of [CSS 2.1 compliant HTML to Microsoft Word conversion?](http://stackoverflow.com/questions/471262/css-2-1-compliant-html-to-microsoft-word-conversion) – Ram Jul 02 '13 at 13:23
  • Some examples [1](http://www.phpclasses.org/package/2763-PHP-Convert-HTML-into-Microsoft-Word-documents.html) [2](http://www.phpdocx.com/documentation/html-to-word-PHP) [3](http://stackoverflow.com/questions/4975266/how-to-convert-html-to-doc-in-php) – PiLHA Jul 02 '13 at 13:28

2 Answers2

0

You could create docx documents (zipped XML files). This is possible with php and you can probably do it with JS too. A bit heavier variant would be to actually use MS Word if you have access to a MS Server or openoffice/libreoffice with bindings.

Laur Ivan
  • 4,117
  • 3
  • 38
  • 62
  • idea is to select certain elements and use jquery to fill a div with those elements and after that export that to a ms-word – user123_456 Jul 02 '13 at 13:25
  • what would be a JS solution? – user123_456 Jul 02 '13 at 13:27
  • for js... apparently there's a [docx.js](https://github.com/stephen-hardy/DOCX.js). I don't use it myself so I can't vouch for it... – Laur Ivan Jul 02 '13 at 13:41
  • imho you'd be better off doing the operation on server (i.e. sending the selected elements e.g. via a POST to the server and processing the request there). Doing it in the client (js) is weird as it can be a rather long operation. – Laur Ivan Jul 02 '13 at 13:44
0

You can use software like

html2rtf translates HTML to RTF. Using this program and the standard windows help compiler, you can convert hyperlinked Web pages into Windows HLP files.

hh2rtf is a set of freeware perl scripts that converts most HtmlHelp formatted HTML to WinHelp-ready RTF.

htm2rtf is another converter for PC/DOS.

html2wrd.zip is a Microsoft Word Basic program to convert HTML documents (including lists, tables and other formatting) into WinWord documents.

Hope this helps out

Tombeau
  • 353
  • 4
  • 14