jdum / odfdo

python library for OpenDocument format (ODF)
Apache License 2.0
48 stars 11 forks source link

How to delete excess lines #20

Closed Sazu-bit closed 1 year ago

Sazu-bit commented 1 year ago

I can't quite figure out how to delete a paragraph with this.

I have empty lines that need removing. With odfpy, I could use "element.parentNode.removeChild(element" but with this I'm not so sure.

Sazu-bit commented 1 year ago

Never mind...

for selectedParagraph in body.get_paragraphs():
    paragraphContent = selectedParagraph.text_recursive

    if paragraphContent == "":
        Paragraph.delete(selectedParagraph)