#1949 - Add auto space DN feature

This commit is contained in:
Dolan Miu
2023-03-17 02:20:51 +00:00
parent 91e8295648
commit 970450074d
2 changed files with 24 additions and 0 deletions

View File

@ -125,6 +125,21 @@ describe("ParagraphProperties", () => {
});
});
it("should create with the autoSpaceEastAsianText property", () => {
const properties = new ParagraphProperties({
autoSpaceEastAsianText: true,
});
const tree = new Formatter().format(properties);
expect(tree).to.deep.equal({
"w:pPr": [
{
"w:autoSpaceDN": {},
},
],
});
});
it("should create with the wordWrap property", () => {
const properties = new ParagraphProperties({
wordWrap: true,

View File

@ -53,6 +53,11 @@ export interface IParagraphPropertiesOptions extends IParagraphStylePropertiesOp
readonly suppressLineNumbers?: boolean;
readonly wordWrap?: boolean;
readonly scale?: number;
/**
* This element specifies whether inter-character spacing shall automatically be adjusted between regions of numbers and regions of East Asian text in the current paragraph. These regions shall be determined by the Unicode character values of the text content within the paragraph.
* This only works in Microsoft Word. It is not part of the ECMA-376 OOXML standard.
*/
readonly autoSpaceEastAsianText?: boolean;
}
export class ParagraphProperties extends IgnoreIfEmptyXmlComponent {
@ -179,6 +184,10 @@ export class ParagraphProperties extends IgnoreIfEmptyXmlComponent {
if (options.suppressLineNumbers !== undefined) {
this.push(new OnOffElement("w:suppressLineNumbers", options.suppressLineNumbers));
}
if (options.autoSpaceEastAsianText !== undefined) {
this.push(new OnOffElement("w:autoSpaceDN", options.autoSpaceEastAsianText));
}
}
public push(item: XmlComponent): void {