Files
docx-js/src/file/paragraph/formatting/spacing.ts

34 lines
909 B
TypeScript
Raw Normal View History

2017-09-21 14:56:46 +01:00
// http://officeopenxml.com/WPspacing.php
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
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",
}
export interface ISpacingProperties {
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;
}
class SpacingAttributes extends XmlAttributeComponent<ISpacingProperties> {
protected readonly xmlKeys = {
after: "w:after",
before: "w:before",
line: "w:line",
2018-06-11 00:45:21 +01:00
lineRule: "w:lineRule",
};
}
export class Spacing extends XmlComponent {
2022-08-31 07:52:27 +01:00
public constructor(options: ISpacingProperties) {
super("w:spacing");
2019-01-11 00:16:25 +00:00
this.root.push(new SpacingAttributes(options));
}
}