I want to delete the carriage return if the word I'm searching is alone on the line.
I'm doing that this way :
(wpDoc is a TWPRichText)
Code
wpDoc->Finder->ToEnd();
while(wpDoc->Finder->Prev(sWord))
{
wpDoc->CPPosition = wpDoc->Finder->FoundPosition;
wpDoc->SelectLine();
sLine = wpDoc->SelText;
if(isAlone(sLine, iLength))
{
wpDoc->SelectLine();
wpDoc->SetSelPosLen(wpDoc->SelStart + wpDoc->SelLength, 1, false);
wpDoc->ClearSelection(true);
}
}
Alles anzeigen
I use a button to launch the function.
The function works perfectly when I click on the button immediately after loading the RTF File in the editor, but when I click on the TWPRichText before launching the function, it deletes more text than needed.
Do I use the right way to do what I want to do? Is there any better solution?
Why doesn't the function work every time I try it?
I need help please.
Thanks.