diff --git a/docx-wasm/js/index.ts b/docx-wasm/js/index.ts index ef94df7b1..0dbcedc54 100644 --- a/docx-wasm/js/index.ts +++ b/docx-wasm/js/index.ts @@ -388,6 +388,15 @@ export class Docx { let num = wasm.createAbstractNumbering(n.id); n.levels.forEach((l) => { let level = wasm.createLevel(l.id, l.start, l.format, l.text, l.jc); + + if (l.levelSuffix === "nothing") { + level = level.suffix(wasm.LevelSuffixType.Nothing); + } else if (l.levelSuffix === "space") { + level = level.suffix(wasm.LevelSuffixType.Space); + } else { + level = level.suffix(wasm.LevelSuffixType.Tab); + } + if (l.paragraphProperty.indent) { let kind; if (l.paragraphProperty.indent.specialIndentKind === "firstLine") { diff --git a/docx-wasm/js/level.ts b/docx-wasm/js/level.ts index 321979641..0d63e383d 100644 --- a/docx-wasm/js/level.ts +++ b/docx-wasm/js/level.ts @@ -1,5 +1,7 @@ import { ParagraphProperty, SpecialIndentKind } from "./paragraph"; +export type LevelSuffixType = "nothing" | "tab" | "space"; + export class Level { id: number; start: number; @@ -7,6 +9,7 @@ export class Level { text: string; jc: string; paragraphProperty: ParagraphProperty = {}; + levelSuffix: LevelSuffixType; constructor( id: number, @@ -20,6 +23,7 @@ export class Level { this.format = format; this.text = text; this.jc = jc; + this.levelSuffix = "tab"; } indent( @@ -34,6 +38,11 @@ export class Level { }; return this; } + + suffix(s: LevelSuffixType) { + this.levelSuffix = s; + return this; + } } export class LevelOverride { diff --git a/docx-wasm/package.json b/docx-wasm/package.json index 54b7ede7f..19a97d5c8 100644 --- a/docx-wasm/package.json +++ b/docx-wasm/package.json @@ -1,6 +1,6 @@ { "name": "docx-wasm", - "version": "0.0.75", + "version": "0.0.76", "main": "dist/node/index.js", "browser": "dist/web/index.js", "author": "bokuweb ", diff --git a/docx-wasm/src/level.rs b/docx-wasm/src/level.rs index 40296973c..77072c578 100644 --- a/docx-wasm/src/level.rs +++ b/docx-wasm/src/level.rs @@ -36,4 +36,9 @@ impl Level { .indent(Some(left), special_indent, None, None); self } + + pub fn suffix(mut self, s: docx_rs::LevelSuffixType) -> Self { + self.0 = self.0.suffix(s); + self + } }