update file/document and section-properties
This commit is contained in:
@ -0,0 +1,41 @@
|
||||
import { decimalNumber, twipsMeasureValue } from "file/values";
|
||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
// <xsd:complexType name="CT_Columns">
|
||||
// <xsd:sequence minOccurs="0">
|
||||
// <xsd:element name="col" type="CT_Column" maxOccurs="45"/>
|
||||
// </xsd:sequence>
|
||||
// <xsd:attribute name="equalWidth" type="s:ST_OnOff" use="optional"/>
|
||||
// <xsd:attribute name="space" type="s:ST_TwipsMeasure" use="optional" default="720"/>
|
||||
// <xsd:attribute name="num" type="ST_DecimalNumber" use="optional" default="1"/>
|
||||
// <xsd:attribute name="sep" type="s:ST_OnOff" use="optional"/>
|
||||
// </xsd:complexType>
|
||||
export interface IColumnsAttributes {
|
||||
readonly space?: number | string;
|
||||
readonly count?: number;
|
||||
readonly separate?: boolean;
|
||||
readonly equalWidth?: boolean;
|
||||
}
|
||||
|
||||
export class ColumnsAttributes extends XmlAttributeComponent<IColumnsAttributes> {
|
||||
protected readonly xmlKeys = {
|
||||
space: "w:space",
|
||||
count: "w:num",
|
||||
separate: "w:sep",
|
||||
equalWidth: "w:equalWidth",
|
||||
};
|
||||
}
|
||||
|
||||
export class Columns extends XmlComponent {
|
||||
constructor({ space, count, separate, equalWidth }: IColumnsAttributes) {
|
||||
super("w:cols");
|
||||
this.root.push(
|
||||
new ColumnsAttributes({
|
||||
space: space === undefined ? undefined : twipsMeasureValue(space),
|
||||
count: count === undefined ? undefined : decimalNumber(count),
|
||||
separate,
|
||||
equalWidth,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user