2017-09-22 14:46:19 +01:00
|
|
|
// http://officeopenxml.com/WPborders.php
|
2022-06-26 23:26:42 +01:00
|
|
|
import { BorderElement, BorderStyle, IBorderOptions } from "@file/border";
|
|
|
|
import { IgnoreIfEmptyXmlComponent, XmlComponent } from "@file/xml-components";
|
2019-06-12 01:03:36 +01:00
|
|
|
|
2024-10-21 03:57:15 +01:00
|
|
|
export type IBordersOptions = {
|
2021-05-23 08:00:49 +03:00
|
|
|
readonly top?: IBorderOptions;
|
|
|
|
readonly bottom?: IBorderOptions;
|
|
|
|
readonly left?: IBorderOptions;
|
|
|
|
readonly right?: IBorderOptions;
|
2024-10-21 03:57:15 +01:00
|
|
|
};
|
2018-08-19 11:59:38 -04:00
|
|
|
|
2021-05-24 09:25:52 +03:00
|
|
|
export class Border extends IgnoreIfEmptyXmlComponent {
|
2022-08-31 07:52:27 +01:00
|
|
|
public constructor(options: IBordersOptions) {
|
2018-08-19 11:59:38 -04:00
|
|
|
super("w:pBdr");
|
|
|
|
|
2021-05-23 08:00:49 +03:00
|
|
|
if (options.top) {
|
|
|
|
this.root.push(new BorderElement("w:top", options.top));
|
2019-06-12 01:03:36 +01:00
|
|
|
}
|
2018-08-19 11:59:38 -04:00
|
|
|
|
2021-05-23 08:00:49 +03:00
|
|
|
if (options.bottom) {
|
|
|
|
this.root.push(new BorderElement("w:bottom", options.bottom));
|
2019-06-12 01:03:36 +01:00
|
|
|
}
|
2018-08-19 11:59:38 -04:00
|
|
|
|
2021-05-23 08:00:49 +03:00
|
|
|
if (options.left) {
|
|
|
|
this.root.push(new BorderElement("w:left", options.left));
|
2019-06-12 01:03:36 +01:00
|
|
|
}
|
2018-08-19 11:59:38 -04:00
|
|
|
|
2021-05-23 08:00:49 +03:00
|
|
|
if (options.right) {
|
|
|
|
this.root.push(new BorderElement("w:right", options.right));
|
2019-06-12 01:03:36 +01:00
|
|
|
}
|
2016-03-29 04:50:23 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-09 20:16:35 +01:00
|
|
|
export class ThematicBreak extends XmlComponent {
|
2022-08-31 07:52:27 +01:00
|
|
|
public constructor() {
|
2016-04-09 20:16:35 +01:00
|
|
|
super("w:pBdr");
|
2021-05-23 08:00:49 +03:00
|
|
|
const bottom = new BorderElement("w:bottom", {
|
2019-06-12 01:03:36 +01:00
|
|
|
color: "auto",
|
|
|
|
space: 1,
|
2021-05-23 08:00:49 +03:00
|
|
|
style: BorderStyle.SINGLE,
|
2019-06-12 01:03:36 +01:00
|
|
|
size: 6,
|
|
|
|
});
|
2018-08-19 11:59:38 -04:00
|
|
|
this.root.push(bottom);
|
2016-03-29 04:50:23 +01:00
|
|
|
}
|
2017-03-08 21:36:09 +00:00
|
|
|
}
|