@turbodocx/html-to-docx 1.12.0 → 1.13.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 +109 -0
- package/dist/html-to-docx.esm.js +2 -2
- package/dist/html-to-docx.esm.js.map +1 -1
- package/dist/html-to-docx.umd.js +2 -2
- package/dist/html-to-docx.umd.js.map +1 -1
- package/index.d.ts +82 -0
- package/package.json +18 -14
- package/example/example-node.js +0 -1798
- package/example/example.js +0 -1778
- package/example/react-example/README.md +0 -70
- package/example/react-example/package-lock.json +0 -23047
- package/example/react-example/package.json +0 -40
package/index.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
|
|
3
|
+
declare namespace HTMLtoDOCX {
|
|
4
|
+
interface Margins {
|
|
5
|
+
top?: number;
|
|
6
|
+
right?: number;
|
|
7
|
+
bottom?: number;
|
|
8
|
+
left?: number;
|
|
9
|
+
header?: number;
|
|
10
|
+
footer?: number;
|
|
11
|
+
gutter?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface PageSize {
|
|
15
|
+
width?: number;
|
|
16
|
+
height?: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface Row {
|
|
20
|
+
cantSplit?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface Table {
|
|
24
|
+
row?: Row;
|
|
25
|
+
borderOptions?: {
|
|
26
|
+
size?: number;
|
|
27
|
+
stroke?: string;
|
|
28
|
+
color?: string;
|
|
29
|
+
};
|
|
30
|
+
addSpacingAfter?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface LineNumberOptions {
|
|
34
|
+
start: number;
|
|
35
|
+
countBy: number;
|
|
36
|
+
restart: "continuous" | "newPage" | "newSection";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface DocumentOptions {
|
|
40
|
+
orientation?: "portrait" | "landscape";
|
|
41
|
+
pageSize?: PageSize;
|
|
42
|
+
margins?: Margins;
|
|
43
|
+
title?: string;
|
|
44
|
+
subject?: string;
|
|
45
|
+
creator?: string;
|
|
46
|
+
keywords?: string[];
|
|
47
|
+
description?: string;
|
|
48
|
+
lastModifiedBy?: string;
|
|
49
|
+
revision?: number;
|
|
50
|
+
createdAt?: Date;
|
|
51
|
+
modifiedAt?: Date;
|
|
52
|
+
headerType?: "default" | "first" | "even";
|
|
53
|
+
header?: boolean;
|
|
54
|
+
footerType?: "default" | "first" | "even";
|
|
55
|
+
footer?: boolean;
|
|
56
|
+
font?: string;
|
|
57
|
+
fontSize?: number;
|
|
58
|
+
complexScriptFontSize?: number;
|
|
59
|
+
table?: Table;
|
|
60
|
+
pageNumber?: boolean;
|
|
61
|
+
skipFirstHeaderFooter?: boolean;
|
|
62
|
+
lineNumber?: boolean;
|
|
63
|
+
lineNumberOptions?: LineNumberOptions;
|
|
64
|
+
numbering?: {
|
|
65
|
+
defaultOrderedListStyleType?: string;
|
|
66
|
+
};
|
|
67
|
+
decodeUnicode?: boolean;
|
|
68
|
+
lang?: string;
|
|
69
|
+
preprocessing?: {
|
|
70
|
+
skipHTMLMinify?: boolean;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
declare function HTMLtoDOCX(
|
|
76
|
+
htmlString: string,
|
|
77
|
+
headerHTMLstring?: string | null,
|
|
78
|
+
documentOptions?: HTMLtoDOCX.DocumentOptions,
|
|
79
|
+
footerHtmlString?: string | null,
|
|
80
|
+
): Promise<ArrayBuffer | Blob | Buffer>;
|
|
81
|
+
|
|
82
|
+
export = HTMLtoDOCX;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turbodocx/html-to-docx",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "HTML to DOCX converter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"html-to-docx",
|
|
@@ -34,10 +34,19 @@
|
|
|
34
34
|
"document generation software",
|
|
35
35
|
"automated document creation",
|
|
36
36
|
"batch document generation",
|
|
37
|
-
"document templating"
|
|
37
|
+
"document templating",
|
|
38
|
+
"typescript",
|
|
39
|
+
"ts"
|
|
38
40
|
],
|
|
39
41
|
"main": "dist/html-to-docx.umd.js",
|
|
40
42
|
"module": "dist/html-to-docx.esm.js",
|
|
43
|
+
"types": "index.d.ts",
|
|
44
|
+
"files": [
|
|
45
|
+
"dist",
|
|
46
|
+
"index.d.ts",
|
|
47
|
+
"README.md",
|
|
48
|
+
"LICENSE"
|
|
49
|
+
],
|
|
41
50
|
"scripts": {
|
|
42
51
|
"test": "npm run build && node example/example-node.js",
|
|
43
52
|
"prerelease": "rollup -c",
|
|
@@ -46,7 +55,8 @@
|
|
|
46
55
|
"prettier:check": "prettier --check '**/*.{js}'",
|
|
47
56
|
"validate": "run-s lint prettier:check",
|
|
48
57
|
"build": "rollup -c",
|
|
49
|
-
"prepare": "husky install"
|
|
58
|
+
"prepare": "husky install",
|
|
59
|
+
"test:ts-example": "npm run build && cross-env TS_NODE_PROJECT=example/typescript/tsconfig.json ts-node -r tsconfig-paths/register example/typescript/typescript-example.ts"
|
|
50
60
|
},
|
|
51
61
|
"repository": {
|
|
52
62
|
"type": "git",
|
|
@@ -89,6 +99,7 @@
|
|
|
89
99
|
"@rollup/plugin-commonjs": "^12.0.0",
|
|
90
100
|
"@rollup/plugin-json": "^4.1.0",
|
|
91
101
|
"@rollup/plugin-node-resolve": "^13.1.1",
|
|
102
|
+
"cross-env": "^7.0.3",
|
|
92
103
|
"eslint": "^7.32.0",
|
|
93
104
|
"eslint-config-airbnb-base": "^14.2.1",
|
|
94
105
|
"eslint-config-prettier": "^8.3.0",
|
|
@@ -101,11 +112,12 @@
|
|
|
101
112
|
"rollup-plugin-cleaner": "^1.0.0",
|
|
102
113
|
"rollup-plugin-node-builtins": "^2.1.2",
|
|
103
114
|
"rollup-plugin-terser": "^7.0.2",
|
|
104
|
-
"standard-version": "^9.3.1"
|
|
115
|
+
"standard-version": "^9.3.1",
|
|
116
|
+
"ts-node": "^10.9.2",
|
|
117
|
+
"tsconfig-paths": "^4.2.0",
|
|
118
|
+
"typescript": "^5.8.3"
|
|
105
119
|
},
|
|
106
120
|
"dependencies": {
|
|
107
|
-
"@oozcitak/dom": "1.15.6",
|
|
108
|
-
"@oozcitak/util": "8.3.4",
|
|
109
121
|
"color-name": "^1.1.4",
|
|
110
122
|
"html-entities": "^2.3.3",
|
|
111
123
|
"html-minifier-terser": "^7.2.0",
|
|
@@ -124,13 +136,5 @@
|
|
|
124
136
|
"prettier --write",
|
|
125
137
|
"eslint --fix"
|
|
126
138
|
]
|
|
127
|
-
},
|
|
128
|
-
"resolutions": {
|
|
129
|
-
"@oozcitak/util": "8.3.4",
|
|
130
|
-
"@oozcitak/dom": "1.15.6"
|
|
131
|
-
},
|
|
132
|
-
"overrides": {
|
|
133
|
-
"@oozcitak/util": "8.3.4",
|
|
134
|
-
"@oozcitak/dom": "1.15.6"
|
|
135
139
|
}
|
|
136
140
|
}
|