html-docx
============

this is a simple library to convert html to docx,it is based on the [html-doxc-js](https://github.com/evidenceprime/html-docx-js)

useage
-------------
#### Usage and demo
```
yarn add html-docx   npm i html-docx --save   cnpm i html-docx --save

import HtmlToDocx from 'html-docx'
HtmlToDocx({
    exportElement: '#html-content', // 需要转换为word的html标签
    exportFileName: 'list.docx', // 转换之后word文档的文件名称
    StringStyle: '', // css样式以字符串的形式插入进去
    margins:{top: 1440,right: 1440,bottom: 1440,left: 1440,header: 720,footer: 720} // word的边距配置
})
```
#### use in-inline in html
[you can use it refer to the example useage](https://github.com/forever-chen/html-docx/blob/master/test/sample.html)

Compatibility
------------

This library should work on any modern browser that supports `Blobs` (either natively or via
[Blob.js](https://github.com/eligrey/Blob.js/)). It was tested on Google Chrome 36, Safari 7 and
Internet Explorer 10.

Images Support
------------

* images/cavans is supported in the library
the src of images can be URI or inlined base64(图片不要太大，因为图片会以base64的格式插入进去)
* cavans can be generate by common charts library or protogenetic(cavans图表也支持)


API
------------
##### `<div id="html-docx-config">`
* 这个元素内部设置元素docx文档的配置信息（具体设置可以到sample例子中看）
##### `<div id="page-header" textAlign='right'>我的新世界</div>` 
* 这个元素内部文字设置为文档的页眉
* textAlign设置文字居中格式
##### `<div id="first-page" titlePg='false'><div style='text-align: center;'>dfsdfsdf</div></div> `
* 这个标签内的元素设置为文档的封面
* 这里不会有页眉、页脚、
* 这里不能有h标签
#### `<div id="page-content"></div>`
* 如果需要目录则添加这个元素，不需要目录就不需要添加这个元素
#### `<div class="change-line"></div>`
* 这个元素用来开启新的页面，在需要开启新页面的地方直接添加这个元素即可
#### `<div id="page-footer"></div>`
* 这里设置页脚，目前只支持页码
#### <div id="html-content">
* 这个元素内部设置需要转换的html内容
* 页面中需要加入目录的标题需要使用h标签来定义
#### 详细使用例子可以到sample.html中查看
reminder
-------------
**all classNames or Id of elements in API cannot be changed(上述api中提供的id都不能随便修改)**

### [you can push issues to](https://github.com/forever-chen/html-docx/pulls) 

License
-------

Copyright (c) 2015 Evidence Prime, Inc.
See the LICENSE file for license rights and limitations (MIT).
