npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

html-docx

v1.2.0

Published

html-docx ============

Downloads

435

Readme

html-docx

this is a simple library to convert html to docx,it is based on the html-doxc-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

Compatibility

This library should work on any modern browser that supports Blobs (either natively or via 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>

  • 这里设置页脚,目前只支持页码

  • 这个元素内部设置需要转换的html内容
  • 页面中需要加入目录的标题需要使用h标签来定义

详细使用例子可以到sample.html中查看

reminder

all classNames or Id of elements in API cannot be changed(上述api中提供的id都不能随便修改)

you can push issues to

License

Copyright (c) 2015 Evidence Prime, Inc. See the LICENSE file for license rights and limitations (MIT).