docx 7.7.0 → 7.8.1
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/LICENSE +21 -21
- package/README.md +3 -2
- package/build/file/document/document.d.ts +1 -1
- package/build/file/numbering/level.d.ts +57 -8
- package/build/file/paragraph/formatting/alignment.d.ts +8 -3
- package/build/file/paragraph/formatting/spacing.d.ts +1 -0
- package/build/file/paragraph/frame/frame-properties.d.ts +1 -1
- package/build/file/paragraph/math/math-component.d.ts +1 -1
- package/build/file/paragraph/paragraph.d.ts +1 -1
- package/build/file/paragraph/run/run-components/text.d.ts +7 -1
- package/build/file/paragraph/run/underline.d.ts +2 -1
- package/build/file/relationships/relationship/relationship.d.ts +1 -1
- package/build/file/xml-components/default-attributes.d.ts +1 -1
- package/build/index.js +1 -1
- package/package.json +5 -5
- package/src/file/document/document.ts +4 -2
- package/src/file/file.ts +1 -1
- package/src/file/numbering/level.ts +126 -8
- package/src/file/paragraph/formatting/alignment.ts +37 -2
- package/src/file/paragraph/formatting/spacing.ts +1 -0
- package/src/file/paragraph/run/run-components/text.spec.ts +22 -0
- package/src/file/paragraph/run/run-components/text.ts +23 -3
- package/src/file/paragraph/run/underline.ts +1 -0
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2016 Dolan
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Dolan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -29,11 +29,12 @@ Here are examples of `docx` being used with basic `HTML/JS` in a browser environ
|
|
|
29
29
|
- https://codepen.io/dolanmiu/pen/RwNeObg
|
|
30
30
|
- https://jsfiddle.net/dolanmiu/onadx1gu/
|
|
31
31
|
|
|
32
|
-
Here
|
|
32
|
+
Here are examples of `docx` working in `Angular`:
|
|
33
33
|
|
|
34
34
|
- https://stackblitz.com/edit/angular-docx
|
|
35
|
+
- https://stackblitz.com/edit/angular-wmd6k3
|
|
35
36
|
|
|
36
|
-
Here
|
|
37
|
+
Here are examples of `docx` working in `React`:
|
|
37
38
|
|
|
38
39
|
- https://stackblitz.com/edit/react-docx
|
|
39
40
|
- https://stackblitz.com/edit/react-docx-images (adding images to Word Document)
|
|
@@ -5,7 +5,7 @@ import { TableOfContents } from "../table-of-contents";
|
|
|
5
5
|
import { Body } from "./body";
|
|
6
6
|
import { IDocumentBackgroundOptions } from "./document-background";
|
|
7
7
|
export interface IDocumentOptions {
|
|
8
|
-
readonly background
|
|
8
|
+
readonly background?: IDocumentBackgroundOptions;
|
|
9
9
|
}
|
|
10
10
|
export declare class Document extends XmlComponent {
|
|
11
11
|
private readonly body;
|
|
@@ -3,20 +3,69 @@ import { AlignmentType } from "../paragraph/formatting";
|
|
|
3
3
|
import { ILevelParagraphStylePropertiesOptions } from "../paragraph/properties";
|
|
4
4
|
import { IRunStylePropertiesOptions } from "../paragraph/run/properties";
|
|
5
5
|
export declare enum LevelFormat {
|
|
6
|
-
|
|
6
|
+
DECIMAL = "decimal",
|
|
7
|
+
UPPER_ROMAN = "upperRoman",
|
|
8
|
+
LOWER_ROMAN = "lowerRoman",
|
|
9
|
+
UPPER_LETTER = "upperLetter",
|
|
10
|
+
LOWER_LETTER = "lowerLetter",
|
|
11
|
+
ORDINAL = "ordinal",
|
|
7
12
|
CARDINAL_TEXT = "cardinalText",
|
|
13
|
+
ORDINAL_TEXT = "ordinalText",
|
|
14
|
+
HEX = "hex",
|
|
8
15
|
CHICAGO = "chicago",
|
|
9
|
-
|
|
16
|
+
IDEOGRAPH__DIGITAL = "ideographDigital",
|
|
17
|
+
JAPANESE_COUNTING = "japaneseCounting",
|
|
18
|
+
AIUEO = "aiueo",
|
|
19
|
+
IROHA = "iroha",
|
|
20
|
+
DECIMAL_FULL_WIDTH = "decimalFullWidth",
|
|
21
|
+
DECIMAL_HALF_WIDTH = "decimalHalfWidth",
|
|
22
|
+
JAPANESE_LEGAL = "japaneseLegal",
|
|
23
|
+
JAPANESE_DIGITAL_TEN_THOUSAND = "japaneseDigitalTenThousand",
|
|
10
24
|
DECIMAL_ENCLOSED_CIRCLE = "decimalEnclosedCircle",
|
|
25
|
+
DECIMAL_FULL_WIDTH2 = "decimalFullWidth2",
|
|
26
|
+
AIUEO_FULL_WIDTH = "aiueoFullWidth",
|
|
27
|
+
IROHA_FULL_WIDTH = "irohaFullWidth",
|
|
28
|
+
DECIMAL_ZERO = "decimalZero",
|
|
29
|
+
BULLET = "bullet",
|
|
30
|
+
GANADA = "ganada",
|
|
31
|
+
CHOSUNG = "chosung",
|
|
11
32
|
DECIMAL_ENCLOSED_FULLSTOP = "decimalEnclosedFullstop",
|
|
12
33
|
DECIMAL_ENCLOSED_PARENTHESES = "decimalEnclosedParen",
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
34
|
+
DECIMAL_ENCLOSED_CIRCLE_CHINESE = "decimalEnclosedCircleChinese",
|
|
35
|
+
IDEOGRAPH_ENCLOSED_CIRCLE = "ideographEnclosedCircle",
|
|
36
|
+
IDEOGRAPH_TRADITIONAL = "ideographTraditional",
|
|
37
|
+
IDEOGRAPH_ZODIAC = "ideographZodiac",
|
|
38
|
+
IDEOGRAPH_ZODIAC_TRADITIONAL = "ideographZodiacTraditional",
|
|
39
|
+
TAIWANESE_COUNTING = "taiwaneseCounting",
|
|
40
|
+
IDEOGRAPH_LEGAL_TRADITIONAL = "ideographLegalTraditional",
|
|
41
|
+
TAIWANESE_COUNTING_THOUSAND = "taiwaneseCountingThousand",
|
|
42
|
+
TAIWANESE_DIGITAL = "taiwaneseDigital",
|
|
43
|
+
CHINESE_COUNTING = "chineseCounting",
|
|
44
|
+
CHINESE_LEGAL_SIMPLIFIED = "chineseLegalSimplified",
|
|
45
|
+
CHINESE_COUNTING_THOUSAND = "chineseCountingThousand",
|
|
46
|
+
KOREAN_DIGITAL = "koreanDigital",
|
|
47
|
+
KOREAN_COUNTING = "koreanCounting",
|
|
48
|
+
KOREAN_LEGAL = "koreanLegal",
|
|
49
|
+
KOREAN_DIGITAL2 = "koreanDigital2",
|
|
50
|
+
VIETNAMESE_COUNTING = "vietnameseCounting",
|
|
51
|
+
RUSSIAN_LOWER = "russianLower",
|
|
52
|
+
RUSSIAN_UPPER = "russianUpper",
|
|
16
53
|
NONE = "none",
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
54
|
+
NUMBER_IN_DASH = "numberInDash",
|
|
55
|
+
HEBREW1 = "hebrew1",
|
|
56
|
+
HEBREW2 = "hebrew2",
|
|
57
|
+
ARABIC_ALPHA = "arabicAlpha",
|
|
58
|
+
ARABIC_ABJAD = "arabicAbjad",
|
|
59
|
+
HINDI_VOWELS = "hindiVowels",
|
|
60
|
+
HINDI_CONSONANTS = "hindiConsonants",
|
|
61
|
+
HINDI_NUMBERS = "hindiNumbers",
|
|
62
|
+
HINDI_COUNTING = "hindiCounting",
|
|
63
|
+
THAI_LETTERS = "thaiLetters",
|
|
64
|
+
THAI_NUMBERS = "thaiNumbers",
|
|
65
|
+
THAI_COUNTING = "thaiCounting",
|
|
66
|
+
BAHT_TEXT = "bahtText",
|
|
67
|
+
DOLLAR_TEXT = "dollarText",
|
|
68
|
+
CUSTOM = "custom"
|
|
20
69
|
}
|
|
21
70
|
export declare enum LevelSuffix {
|
|
22
71
|
NOTHING = "nothing",
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { XmlAttributeComponent, XmlComponent } from "../../../file/xml-components";
|
|
2
2
|
export declare enum AlignmentType {
|
|
3
3
|
START = "start",
|
|
4
|
-
END = "end",
|
|
5
4
|
CENTER = "center",
|
|
5
|
+
END = "end",
|
|
6
6
|
BOTH = "both",
|
|
7
|
-
|
|
7
|
+
MEDIUM_KASHIDA = "mediumKashida",
|
|
8
8
|
DISTRIBUTE = "distribute",
|
|
9
|
+
NUM_TAB = "numTab",
|
|
10
|
+
HIGH_KASHIDA = "highKashida",
|
|
11
|
+
LOW_KASHIDA = "lowKashida",
|
|
12
|
+
THAI_DISTRIBUTE = "thaiDistribute",
|
|
9
13
|
LEFT = "left",
|
|
10
|
-
RIGHT = "right"
|
|
14
|
+
RIGHT = "right",
|
|
15
|
+
JUSTIFIED = "both"
|
|
11
16
|
}
|
|
12
17
|
export declare class AlignmentAttributes extends XmlAttributeComponent<{
|
|
13
18
|
readonly val: AlignmentType;
|
|
@@ -48,7 +48,7 @@ export interface IAlignmentFrameOptions extends IBaseFrameOptions {
|
|
|
48
48
|
readonly y: VerticalPositionAlign;
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
export
|
|
51
|
+
export type IFrameOptions = IXYFrameOptions | IAlignmentFrameOptions;
|
|
52
52
|
export declare class FramePropertiesAttributes extends XmlAttributeComponent<{
|
|
53
53
|
readonly anchorLock?: boolean;
|
|
54
54
|
readonly dropCap?: DropCapType;
|
|
@@ -5,5 +5,5 @@ import { MathRun } from "./math-run";
|
|
|
5
5
|
import { MathSum, MathIntegral } from "./n-ary";
|
|
6
6
|
import { MathRadical } from "./radical";
|
|
7
7
|
import { MathSubScript, MathSubSuperScript, MathSuperScript } from "./script";
|
|
8
|
-
export
|
|
8
|
+
export type MathComponent = MathRun | MathFraction | MathSum | MathIntegral | MathSuperScript | MathSubScript | MathSubSuperScript | MathRadical | MathFunction | MathRoundBrackets | MathCurlyBrackets | MathAngledBrackets | MathSquareBrackets;
|
|
9
9
|
export declare const WORKAROUND4 = "";
|
|
@@ -7,7 +7,7 @@ import { Math } from "./math";
|
|
|
7
7
|
import { IParagraphPropertiesOptions } from "./properties";
|
|
8
8
|
import { ImageRun, Run, SequentialIdentifier, SimpleField, SimpleMailMergeField, SymbolRun, TextRun } from "./run";
|
|
9
9
|
import { Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments } from "./run/comment-run";
|
|
10
|
-
export
|
|
10
|
+
export type ParagraphChild = TextRun | ImageRun | SymbolRun | Bookmark | PageBreak | ColumnBreak | SequentialIdentifier | FootnoteReferenceRun | InternalHyperlink | ExternalHyperlink | InsertedTextRun | DeletedTextRun | Math | SimpleField | SimpleMailMergeField | Comments | Comment | CommentRangeStart | CommentRangeEnd | CommentReference;
|
|
11
11
|
export interface IParagraphOptions extends IParagraphPropertiesOptions {
|
|
12
12
|
readonly text?: string;
|
|
13
13
|
readonly children?: readonly ParagraphChild[];
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import { SpaceType } from "../../../../file/shared";
|
|
1
2
|
import { XmlComponent } from "../../../../file/xml-components";
|
|
3
|
+
interface ITextOptions {
|
|
4
|
+
readonly space?: SpaceType;
|
|
5
|
+
readonly text?: string;
|
|
6
|
+
}
|
|
2
7
|
export declare class Text extends XmlComponent {
|
|
3
|
-
constructor(
|
|
8
|
+
constructor(options: string | ITextOptions);
|
|
4
9
|
}
|
|
10
|
+
export {};
|
|
@@ -16,7 +16,8 @@ export declare enum UnderlineType {
|
|
|
16
16
|
DASHDOTDOTHEAVY = "dashDotDotHeavy",
|
|
17
17
|
WAVE = "wave",
|
|
18
18
|
WAVYHEAVY = "wavyHeavy",
|
|
19
|
-
WAVYDOUBLE = "wavyDouble"
|
|
19
|
+
WAVYDOUBLE = "wavyDouble",
|
|
20
|
+
NONE = "none"
|
|
20
21
|
}
|
|
21
22
|
export declare class Underline extends XmlComponent {
|
|
22
23
|
constructor(underlineType?: UnderlineType, color?: string);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { XmlComponent } from "../../../file/xml-components";
|
|
2
|
-
export
|
|
2
|
+
export type RelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" | "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments";
|
|
3
3
|
export declare enum TargetModeType {
|
|
4
4
|
EXTERNAL = "External"
|
|
5
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseXmlComponent, IContext } from "./base";
|
|
2
2
|
import { IXmlableObject } from "./xmlable-object";
|
|
3
|
-
export
|
|
3
|
+
export type AttributeMap<T> = {
|
|
4
4
|
readonly [P in keyof T]: string;
|
|
5
5
|
};
|
|
6
6
|
export declare abstract class XmlAttributeComponent<T extends object> extends BaseXmlComponent {
|