Create CheckBox element and supporting child elements
This commit is contained in:
29
src/file/checkbox/checkbox-symbol.ts
Normal file
29
src/file/checkbox/checkbox-symbol.ts
Normal file
@ -0,0 +1,29 @@
|
||||
// This represents element type CT_SdtCheckboxSymbol element
|
||||
// <xsd:complexType name="CT_SdtCheckboxSymbol">
|
||||
// <xsd:attribute name="font" type="w:ST_String"/>
|
||||
// <xsd:attribute name="val" type="w:ST_ShortHexNumber"/>
|
||||
// </xsd:complexType>
|
||||
|
||||
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
import { shortHexNumber } from "@util/values";
|
||||
|
||||
class CheckboxSymbolAttributes extends XmlAttributeComponent<{
|
||||
readonly val?: string | number | boolean;
|
||||
readonly symbolfont?: string;
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
val: "w14:val",
|
||||
symbolfont: "w14:font",
|
||||
};
|
||||
}
|
||||
|
||||
export class CheckBoxSymbolElement extends XmlComponent {
|
||||
public constructor(name: string, val: string, font?: string) {
|
||||
super(name);
|
||||
if (font) {
|
||||
this.root.push(new CheckboxSymbolAttributes({ val: shortHexNumber(val), symbolfont: font }));
|
||||
} else {
|
||||
this.root.push(new CheckboxSymbolAttributes({ val }));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user