docx 9.7.1 → 9.8.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 CHANGED
@@ -65,6 +65,33 @@ More [here](https://github.com/dolanmiu/docx/tree/master/demo)
65
65
 
66
66
  Please refer to the [documentation at https://docx.js.org/](https://docx.js.org/) for details on how to use this library, examples and much more!
67
67
 
68
+ # Shapes, watermarks and charts
69
+
70
+ Shapes, groups of shapes and diagrams with connectors come with `docx`, from `docx/shapes`, watermarks from `docx/watermarks`, and native Word charts from `docx/charts`. They are left out of `docx` itself, so documents that don't use them don't carry their code:
71
+
72
+ ```ts
73
+ import { Document, Header, Paragraph } from "docx";
74
+ import { ChartRun } from "docx/charts";
75
+ import { ShapeRun } from "docx/shapes";
76
+ import { TextWatermark } from "docx/watermarks";
77
+
78
+ const doc = new Document({
79
+ sections: [
80
+ {
81
+ headers: { default: new Header({ children: [new Paragraph({ children: [new TextWatermark({ text: "DRAFT" })] })] }) },
82
+ children: [
83
+ new Paragraph({ children: [new ShapeRun({ type: "ellipse", transformation: { width: 100, height: 60 } })] }),
84
+ new Paragraph({
85
+ children: [new ChartRun({ type: "column", categories: ["Q1", "Q2"], series: [{ name: "Sales", values: [10, 20] }] })],
86
+ }),
87
+ ],
88
+ },
89
+ ],
90
+ });
91
+ ```
92
+
93
+ In a page without a bundler, load `dist/shapes.umd.cjs`, `dist/watermarks.umd.cjs` or `dist/charts.umd.cjs` after `dist/index.umd.cjs`. They add the `docxShapes`, `docxWatermarks` and `docxCharts` globals. See the [shapes](https://docx.js.org/#/usage/shapes), [watermarks](https://docx.js.org/#/usage/watermarks) and [charts](https://docx.js.org/#/usage/charts) documentation.
94
+
68
95
  # Playground
69
96
 
70
97
  Experience `docx` in action through [Docx.js Editor][docxjs-editor-url], an interactive playground where you can code and preview the results in real-time.