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

37 lines
965 B
TypeScript
Raw Normal View History

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";
export interface ISpacingProperties {
readonly after?: number;
readonly before?: number;
readonly line?: number;
readonly lineRule?: string;
}
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 {
2019-01-11 00:16:25 +00:00
constructor(options: ISpacingProperties) {
super("w:spacing");
2019-01-11 00:16:25 +00:00
this.root.push(new SpacingAttributes(options));
}
}
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,
}),
);
}
}