You are on page 1of 2

HTML to Word Converter

This is an example file - written in HTML - to give some examples of what this converter can do.

Typically you might use this converter to convert the HTML output of a WYSIWYG editor such as TinyMCE. It is not intended to produce an accurate version of complex web page layouts, rather to produce a user-friendly Word document that people can easily edit with Word (in contrast to the horrible results you often get by copying and pasting from a web page into Word).

This is a heading (h2)


This is a paragraph. We can format text within paragraphs, divs and table cells, e.g. with bold, italic, underline.

Note that headings can be constructed with some text followed by an empty line (as in the heading at the top), or with line spacing set between the heading and the following text (as with the heading for this part of the document). This can also be applied to paragraphs and divs.

Lists
This converter uses "pseudo lists" - these are paragraphs formatted to look like Word lists. This has been done to allow pieces of text within the list to be styled (doesn't appear to be possible with PHPWord - you can only style entire list elements. This converter is not currently set up to make PHPWord lists - this is a "to do"!

Currently only psuedo lists are available.

Bulleted:
Point Point Point

1 2 3

Numbered:
1. Item 1 - we can style things in these lists

2. A purple item 3. Two classes - green wins out!

Tables
You can insert a table:

Column 1 Here's some data.

Column 2 Here's a cat aligned in the middle:

Column 3 ...and here's one aligned to the right:

You need to specifiy the width of the image in the tag (height=y width=x) and this is in pixels or you will get the default size as determined by PHPWord. Converting at 15 TWIPS per pixel.

You can't nest tables though - but the converter will try and do something sensible with any nested tables it finds:

Heading 1 Nested Col 1 Nested Col 2 Nested Col 3 Nested data 1 Nested data 2 Nested data 3

Heading 2 Data col 2

If the converter finds an element it doesn't understand or which is in the wrong place or can't be rendered by PHPWord, the inner text of the element is returned instead.

A Link
Link to DuckDuckGo!

Special Characters
"copyright": "and":

& than": >

"greater

You might also like