Snippets
- Learn phpdocx in 5 minutes
- Tutorial
- API quick guide
- HTML to Word
- HTML Extended
- Conversion plugin
- Word to HTML
- DOCXPath
- Bulk processing
- DOCXCustomizer
- Digital signature
- Cryptophpdocx
- Right to left languages
- phpdocx CLI command
- Tracking
- Artificial Intelligence
- Blockchain for documents
- JavaScript API
- Compiled mode
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.