2017-09-21 14:56:46 +01:00
|
|
|
// http://officeopenxml.com/WPspacing.php
|
2022-06-26 23:26:42 +01:00
|
|
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
2017-03-09 12:12:33 +01:00
|
|
|
|
2021-03-15 19:23:40 +00:00
|
|
|
export enum LineRuleType {
|
|
|
|
AT_LEAST = "atLeast",
|
|
|
|
EXACTLY = "exactly",
|
2022-11-19 15:51:41 +00:00
|
|
|
EXACT = "exact",
|
2021-03-15 19:23:40 +00:00
|
|
|
AUTO = "auto",
|
|
|
|
}
|
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;
|
2021-03-15 19:23:40 +00:00
|
|
|
readonly lineRule?: LineRuleType;
|
|
|
|
readonly beforeAutoSpacing?: boolean;
|
|
|
|
readonly afterAutoSpacing?: boolean;
|
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 {
|
2022-08-31 07:52:27 +01:00
|
|
|
public 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
|
|
|
}
|
|
|
|
}
|