docx-plus 0.1.6 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -40
- package/dist/index.cjs +6 -31994
- package/dist/index.d.cts +1 -4967
- package/dist/index.d.mts +1 -4969
- package/dist/index.mjs +2 -31648
- package/package.json +13 -53
- package/dist/index.iife.js +0 -31996
- package/dist/index.umd.js +0 -32003
package/README.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
# docx-plus
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
[![PRs Welcome][pr-image]][pr-url]
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
7
6
|
|
|
8
|
-
Easily generate and modify .docx files with JS/TS. Works for Node and on the Browser.
|
|
7
|
+
Easily generate and modify .docx files with JS/TS. Works for Node.js and on the Browser.
|
|
9
8
|
|
|
10
|
-
**docx-plus** is an enhanced fork of [docx](https://github.com/dolanmiu/docx) — a TypeScript/JavaScript library for generating and modifying Word documents (.docx) programmatically with a declarative API.
|
|
9
|
+
**docx-plus** is an enhanced fork of [docx](https://github.com/dolanmiu/docx) by Dolan Miu — a TypeScript/JavaScript library for generating and modifying Word documents (.docx) programmatically with a declarative API. We extend our sincere gratitude to the original author and all contributors for their foundational work.
|
|
10
|
+
|
|
11
|
+
This package re-exports everything from `@office-open/docx` for backward compatibility. If you are starting a new project, we recommend using `@office-open/docx` directly.
|
|
11
12
|
|
|
12
13
|
## What's Different from docx?
|
|
13
14
|
|
|
@@ -46,40 +47,36 @@ Easily generate and modify .docx files with JS/TS. Works for Node and on the Bro
|
|
|
46
47
|
| Math advanced | Basic math only | **Complete** (box, borderBox, eqArr, groupChr, matrix, phant, accent, fraction, nAry, func, delim, bar, limLow, limUpp, sPre, sSub, sSup) |
|
|
47
48
|
| Group Shape | Basic (transform only) | **Enhanced** (fill, effects, `chOff`/`chExt` child coordinates) |
|
|
48
49
|
| Test environment | jsdom | happy-dom |
|
|
49
|
-
| OOXML compliance | ECMA-376 (legacy) | **ISO/IEC 29500-4** (latest) — comprehensive WordprocessingML, DrawingML, and Shared Math coverage
|
|
50
|
+
| OOXML compliance | ECMA-376 (legacy) | **ISO/IEC 29500-4** (latest) — comprehensive WordprocessingML, DrawingML, and Shared Math coverage |
|
|
50
51
|
|
|
51
52
|
## OOXML Coverage
|
|
52
53
|
|
|
53
54
|
**docx-plus** provides comprehensive coverage of the WordprocessingML, DrawingML, and Shared Math specifications within ISO/IEC 29500-4. This includes:
|
|
54
55
|
|
|
55
56
|
- **WordprocessingML**: paragraphs, runs, tables (full row/cell/table properties), sections, headers/footers, footnotes/endnotes, table of contents, numbering/lists, styles, bookmarks, hyperlinks, SDT content controls, form fields, track changes, comments, bibliography sources, math equations, ruby annotations, and more
|
|
56
|
-
- **DrawingML**: shapes, images, text bodies, colors (all 6 color types + 29 transforms), fills (solid, gradient, pattern, group), outlines, effects (28 types with recursive containers), 3D scenes, custom geometry, and
|
|
57
|
+
- **DrawingML**: shapes, images, text bodies, colors (all 6 color types + 29 transforms), fills (solid, gradient, pattern, group), outlines, effects (28 types with recursive containers), 3D scenes, custom geometry, image adjustments, **charts** (bar, column, line, pie, area, scatter), and **SmartArt** diagrams (process, hierarchy, cycle, pyramid, list)
|
|
57
58
|
- **Shared Math**: all equation structures (fraction, radical, n-ary, integrals, matrices, accents, delimiters, etc.)
|
|
58
59
|
|
|
59
60
|
**Not in scope** (separate OOXML domains with their own dedicated specifications):
|
|
60
61
|
|
|
61
|
-
- **SmartArt** (`dgm:`) — graphical diagram engine
|
|
62
|
-
- **Charts** (`c:`) — native OOXML charting (typically handled by charting libraries)
|
|
63
62
|
- **Mail Merge** — field codes are supported, but external data source connections are not
|
|
64
63
|
- **Cover Pages** — `docPartObj` SDT is supported, but Building Blocks part references require template files
|
|
65
64
|
|
|
66
65
|
## Installation
|
|
67
66
|
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
```bash
|
|
68
|
+
# Install with npm
|
|
69
|
+
$ npm install docx-plus
|
|
71
70
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// or
|
|
75
|
-
import { Document, Packer, Paragraph, TextRun } from "docx-plus";
|
|
71
|
+
# Install with pnpm
|
|
72
|
+
$ pnpm add docx-plus
|
|
76
73
|
```
|
|
77
74
|
|
|
78
|
-
## Quick
|
|
75
|
+
## Quick Start
|
|
79
76
|
|
|
80
|
-
```
|
|
81
|
-
import
|
|
82
|
-
import {
|
|
77
|
+
```typescript
|
|
78
|
+
import { Document, Paragraph, TextRun, Packer } from "docx-plus";
|
|
79
|
+
import { writeFileSync } from "node:fs";
|
|
83
80
|
|
|
84
81
|
const doc = new Document({
|
|
85
82
|
sections: [
|
|
@@ -100,28 +97,13 @@ const doc = new Document({
|
|
|
100
97
|
});
|
|
101
98
|
|
|
102
99
|
const buffer = await Packer.toBuffer(doc);
|
|
103
|
-
|
|
100
|
+
writeFileSync("My Document.docx", buffer);
|
|
104
101
|
```
|
|
105
102
|
|
|
106
|
-
## Documentation
|
|
107
|
-
|
|
108
|
-
Please refer to the [documentation](https://github.com/DemoMacro/docx-plus#readme) for details on how to use this library, examples and much more!
|
|
109
|
-
|
|
110
103
|
## Examples
|
|
111
104
|
|
|
112
|
-
Check the [demo folder](
|
|
113
|
-
|
|
114
|
-
## Contributing
|
|
115
|
-
|
|
116
|
-
Contributions are welcome! Please feel free to submit pull requests.
|
|
105
|
+
Check the [demo folder](../docx/demo) for 100+ working examples covering every feature.
|
|
117
106
|
|
|
118
|
-
|
|
107
|
+
## License
|
|
119
108
|
|
|
120
|
-
[
|
|
121
|
-
[npm-url]: https://npmjs.org/package/docx-plus
|
|
122
|
-
[downloads-image]: https://img.shields.io/npm/dm/docx-plus.svg
|
|
123
|
-
[downloads-url]: https://npmjs.org/package/docx-plus
|
|
124
|
-
[github-actions-workflow-image]: https://github.com/DemoMacro/docx-plus/workflows/Default/badge.svg?branch=main
|
|
125
|
-
[github-actions-workflow-url]: https://github.com/DemoMacro/docx-plus/actions
|
|
126
|
-
[pr-image]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg
|
|
127
|
-
[pr-url]: http://makeapullrequest.com
|
|
109
|
+
- [MIT](LICENSE) © [Demo Macro](https://imst.xyz/)
|