Snippets

Remove the last paragraph in a DOCX

When creating a new MS Word document it is usual to add an empty paragraph at the end. This paragraph can generate a new blank page, for example in LibreOffice if the existing content fills the whole previous page.

Deleting that last paragraph is as easy as executing:

This code can be called when creating a new document or to generate a new base template already clean and ready to be reused.