How to remove certain rogue blank paragraphs
Posted: 28 Mar 2024, 21:44
How to remove certain rogue blank paragraphs, I want to remove rogue blank paragraphs from 3 to 8, but keep 1 and 2, that's the rogue blank paragraphs with no text in between.The code written by flyingDman would remove all of them.
Code: Select all
oWord := ComObjActive("Word.Application")
oWord.selection.wholestory
loop oWord.ActiveDocument.Paragraphs.count
(strlen(oWord.selection.paragraphs.item(a_index).range.text) = 1) && lst .= a_index ","
if lst ?? ""
for x,y in strsplit(sort(trim(lst,","),"NRD,"),",")
oWord.selection.paragraphs.item(y).range.delete()