https://github.com/ainilili/html2docx
html convert to docx.
https://github.com/ainilili/html2docx
converter documentation docx html openxml
Last synced: 7 months ago
JSON representation
html convert to docx.
- Host: GitHub
- URL: https://github.com/ainilili/html2docx
- Owner: ainilili
- License: mit
- Created: 2023-04-13T05:36:17.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-14T01:59:51.000Z (almost 3 years ago)
- Last Synced: 2025-01-18T06:43:29.972Z (about 1 year ago)
- Topics: converter, documentation, docx, html, openxml
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Introduction
Convert [HTML](https://zh.wikipedia.org/wiki/HTML) to [DOCX](https://zh.wikipedia.org/wiki/Office_Open_XML)
# Install
```shell
go get github.com/ainilili/html2docx
```
# Usage
```go
package main
import (
"github.com/ainilili/html2docx"
"log"
"os"
)
func main() {
source := `
我的网页
欢迎来到我的网页
这是一个简单的HTML文档。
`
dist, err := html2docx.Convert([]byte(source))
if err != nil {
log.Fatalln(err)
}
err = os.WriteFile("test.docx", dist, 0666)
if err != nil {
panic(err)
}
}
```