Fix for empty first paragraph

If there is only one section, remove the extraneous empty paragraph during XML creation.
This commit is contained in:
mustapelto
2019-12-15 22:56:24 +02:00
parent a13f898ad3
commit 96471ecb45
3 changed files with 13 additions and 15 deletions

View File

@ -22,9 +22,6 @@ describe("Body", () => {
expect(tree).to.deep.equal({
"w:body": [
{
"w:p": {},
},
{
"w:sectPr": [
{ "w:pgSz": { _attr: { "w:w": 10000, "w:h": 10000, "w:orient": "portrait" } } },

View File

@ -26,6 +26,7 @@ export class Body extends XmlComponent {
public prepForXml(): IXmlableObject | undefined {
if (this.sections.length === 1) {
this.root.splice(0, 1);
this.root.push(this.sections.pop() as SectionProperties);
}