Bug 919: Ensure clearText() produces valid XML by adding default empty paragraph - #1192
Open
waterWang wants to merge 1 commit into
Open
Bug 919: Ensure clearText() produces valid XML by adding default empty paragraph#1192waterWang wants to merge 1 commit into
waterWang wants to merge 1 commit into
Conversation
…y paragraph When clearText() is called on a text shape, it removes all paragraphs from the CTTextBody, resulting in an invalid OOXML document. This fix adds a default empty paragraph after clearing to ensure the XML remains valid even when no new content is added before saving. Fixes apache#919
Member
|
#1190 is linked to that issue too. Review 1190 and tell me why this is better. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When
clearText()is called on a text shape (e.g.,XSLFTextBox), it removes all paragraphs from theCTTextBody. If the shape is saved without adding new content, the resulting OOXML document is invalid because the OOXML spec requires at least one paragraph in a text body.Fix
After clearing all paragraphs, add a default empty paragraph to ensure the XML remains valid. This allows
clearText()to be used safely without immediately adding new content.Test
Added
testClearTextWithEmptyParagraph()that:clearText()Fixes #919