From 20e0213c7d4d1eb2c13465da1f18d3f26ea67bb5 Mon Sep 17 00:00:00 2001 From: Juan D Date: Thu, 22 Jun 2023 15:37:00 -0400 Subject: [PATCH] Revert "Revert unnecessary changes to sdt-properties" This reverts commit d1f75e3a422a6b5109e9894bc5edf2c45a9c112e. --- src/file/table-of-contents/sdt-properties.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/file/table-of-contents/sdt-properties.ts b/src/file/table-of-contents/sdt-properties.ts index 241122593a..481235752a 100644 --- a/src/file/table-of-contents/sdt-properties.ts +++ b/src/file/table-of-contents/sdt-properties.ts @@ -1,10 +1,25 @@ // http://www.datypic.com/sc/ooxml/e-w_sdtPr-1.html +import { CheckBoxUtil } from "@file/checkbox"; import { StringValueElement, XmlComponent } from "@file/xml-components"; +export type SdtPrChild = + | CheckBoxUtil; + +export interface ISdtPropertiesOptions { + readonly children : readonly SdtPrChild[]; +} export class StructuredDocumentTagProperties extends XmlComponent { - public constructor(alias: string) { + public constructor(alias?: string, options?: ISdtPropertiesOptions) { super("w:sdtPr"); - this.root.push(new StringValueElement("w:alias", alias)); + if(typeof alias === 'string'){ + this.root.push(new StringValueElement("w:alias", alias)); + } + + if(options?.children){ + for(const child of options.children){ + this.root.push(child) + } + } } }