diff --git a/src/file/table-of-contents/instruction.ts b/src/file/table-of-contents/instruction.ts index fae0339313..7fe253e783 100644 --- a/src/file/table-of-contents/instruction.ts +++ b/src/file/table-of-contents/instruction.ts @@ -37,20 +37,20 @@ export class TableOfContentsInstruction extends XmlComponent { this.root.push(new TextAttributes({ space: "preserve" })); let instruction = "TOC"; if (this.properties.entriesFromSession) { - instruction = `${instruction} \b "${this.properties.entriesFromSession}"`; + instruction = `${instruction} \\b "${this.properties.entriesFromSession}"`; } if (this.properties.hiperlink) { - instruction = `${instruction} \h`; + instruction = `${instruction} \\h`; } if (this.properties.entryLevelsRange) { - instruction = `${instruction} \n "${this.properties.entryLevelsRange}"`; + instruction = `${instruction} \\n "${this.properties.entryLevelsRange}"`; } if (this.properties.headerRange) { - instruction = `${instruction} \o "${this.properties.headerRange}"`; + instruction = `${instruction} \\o "${this.properties.headerRange}"`; } if (this.properties.styles && this.properties.styles.length) { const styles = this.properties.styles.map((sl) => `${sl.styleName}, ${sl.level}`).join(", "); - instruction = `${instruction} \t "${styles}"`; + instruction = `${instruction} \\t "${styles}"`; } this.root.push(instruction); } diff --git a/src/file/table-of-contents/table-of-contents.spec.ts b/src/file/table-of-contents/table-of-contents.spec.ts index 864f1c36cd..3ff1eab243 100644 --- a/src/file/table-of-contents/table-of-contents.spec.ts +++ b/src/file/table-of-contents/table-of-contents.spec.ts @@ -33,7 +33,7 @@ const DEFAULT_TOC = { "xml:space": "preserve", }, }, - 'TOC \n "1-6"', + 'TOC \\n "1-6"', ], }, {