feature: remove single run/paragraph
See original GitHub issueI make some pptx templates processing and this is really desired feature for me. API proposal:
paragraph.remove(run)
and
textframe.remove(paragraph)
Issue Analytics
- State:
- Created 9 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to Quickly Remove Paragraph Marks or Hard Returns ...
You can remove a single hard return or paragraph mark by dragging over it and pressing Delete. Removing hard returns or paragraph marks...
Read more >How to remove all empty paragraphs in Word?
Click Run Macro on the Run tab. arrow blue right bubble Remove all empty paragraphs with kutools for Word. To remove all empty...
Read more >Javascript regex, make remove single paragraph line breaks
I'm trying to do this all client side, currently running it in Firefox. I'm not the best with regex, so this might be...
Read more >How to Remove Paragraph Breaks & Keep Spaces ... - YouTube
Remove paragraph breaks and keep paragraphs together in Microsoft Word ... Word is one of the most widely used word processors in existence....
Read more >Control pagination
On the Format menu, click Paragraph, and then click the Line and Page Breaks tab. Select the Keep lines together check box. Keep...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @theres, I think the API we’ll use is .delete() on each individual object for which it’s valid, so something like this:
In the meantime, this code should do the trick for plain content. The trickiness comes in when there are links to external content, like a picture or hyperlink:
You’ll need to be careful about using any remaining reference to the paragraph after calling
delete_paragraph()
. It will seem to work but won’t affect the presentation content that gets saved. That’s one of the reasons using the formdelete_paragraph(text_frame.paragraphs[idx])
would be preferred since it doesn’t leave a reference hanging around.Dealing with these smaller details and edge cases will be some of the work that will go into the actual feature when we add it.
Let us know how you go if you decide to use the workaround function 😃
Hi Scanny, Thanks for your response, it is work now. I find I used it in a wrong way. Sorry for this issue.