// http://officeopenxml.com/WPindentation.php
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
import { signedTwipsMeasureValue, twipsMeasureValue } from "@util/values";
export interface IIndentAttributesProperties {
readonly start?: number | string;
readonly end?: number | string;
readonly left?: number | string;
readonly right?: number | string;
readonly hanging?: number | string;
readonly firstLine?: number | string;
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
class IndentAttributes extends XmlAttributeComponent {
protected readonly xmlKeys = {
start: "w:start",
end: "w:end",
left: "w:left",
right: "w:right",
hanging: "w:hanging",
firstLine: "w:firstLine",
};
}
//
//
// ...
//
export class Indent extends XmlComponent {
public constructor({ start, end, left, right, hanging, firstLine }: IIndentAttributesProperties) {
super("w:ind");
this.root.push(
new IndentAttributes({
start: start === undefined ? undefined : signedTwipsMeasureValue(start),
end: end === undefined ? undefined : signedTwipsMeasureValue(end),
left: left === undefined ? undefined : signedTwipsMeasureValue(left),
right: right === undefined ? undefined : signedTwipsMeasureValue(right),
hanging: hanging === undefined ? undefined : twipsMeasureValue(hanging),
firstLine: firstLine === undefined ? undefined : twipsMeasureValue(firstLine),
}),
);
}
}