added a method for clear the page breaks of a paragraph

This commit is contained in:
Sergio Mendonça
2018-09-18 13:53:30 -03:00
parent 8e911698a5
commit baf0f17bd6
3 changed files with 17 additions and 3 deletions

View File

@ -240,4 +240,10 @@ export class Paragraph extends XmlComponent {
this.root.splice(1, 0, run);
return this;
}
public clearPageBreaks(): Paragraph {
this.root = this.root.filter((child) => !(child instanceof PageBreak));
this.properties.clearPageBreaks();
return this;
}
}

View File

@ -1,6 +1,7 @@
// http://officeopenxml.com/WPparagraphProperties.php
import { XmlComponent } from "file/xml-components";
import { Border } from "./formatting/border";
import { PageBreakBefore } from "./formatting/page-break";
import { Style } from "./formatting/style";
export class ParagraphProperties extends XmlComponent {
@ -22,4 +23,9 @@ export class ParagraphProperties extends XmlComponent {
public getStyles(): Style[] {
return this.root.filter((child) => child instanceof Style) as Style[];
}
public clearPageBreaks(): ParagraphProperties {
this.root = this.root.filter((child) => !(child instanceof PageBreakBefore));
return this;
}
}