2017-09-21 14:56:46 +01:00
|
|
|
// http://officeopenxml.com/WPspacing.php
|
2018-09-26 17:47:17 +03:00
|
|
|
import { Attributes, XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
2017-03-09 12:12:33 +01:00
|
|
|
|
|
|
|
export interface ISpacingProperties {
|
2018-11-02 02:51:57 +00:00
|
|
|
readonly after?: number;
|
|
|
|
readonly before?: number;
|
|
|
|
readonly line?: number;
|
|
|
|
readonly lineRule?: string;
|
2017-03-09 12:12:33 +01:00
|
|
|
}
|
|
|
|
|
2017-03-10 10:42:24 +01:00
|
|
|
class SpacingAttributes extends XmlAttributeComponent<ISpacingProperties> {
|
2018-11-02 02:51:57 +00:00
|
|
|
protected readonly xmlKeys = {
|
2017-03-10 10:42:24 +01:00
|
|
|
after: "w:after",
|
|
|
|
before: "w:before",
|
|
|
|
line: "w:line",
|
2018-06-11 00:45:21 +01:00
|
|
|
lineRule: "w:lineRule",
|
2017-03-10 10:42:24 +01:00
|
|
|
};
|
2017-03-09 12:12:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export class Spacing extends XmlComponent {
|
2019-01-11 00:16:25 +00:00
|
|
|
constructor(options: ISpacingProperties) {
|
2017-03-09 12:12:33 +01:00
|
|
|
super("w:spacing");
|
2019-01-11 00:16:25 +00:00
|
|
|
this.root.push(new SpacingAttributes(options));
|
2017-03-09 12:12:33 +01:00
|
|
|
}
|
|
|
|
}
|
2018-09-26 17:47:17 +03:00
|
|
|
|
|
|
|
export class ContextualSpacing extends XmlComponent {
|
|
|
|
constructor(value: boolean) {
|
|
|
|
super("w:contextualSpacing");
|
|
|
|
this.root.push(
|
|
|
|
new Attributes({
|
|
|
|
val: value === false ? 0 : 1,
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|