SelectionAsString not copying just the selection?

  • In WPTools 5, the following was used to copy the selected text, But in WPTools8, it copies the whole thing. What am I missing now?

    Code
    WPRichText_Temp.SelStart := vStartPos;
    WPRichText_Temp.SelLength := (vEndPos - vStartPos) + 1;
    WPRichText3.Clear;
    WPRichText3.AsString := WPRichText_Temp.SelectionAsString;

    In one case, SelStart is 851 and SelLength is 1432, but it still copies all of WPRichText_Temp into WPRichText3.

  • It appears to be related to bookmarks and their Tag property screwing me up. In WPTools 5, the start object's tag value seems to always be 0, but now in WPTools 8, it is not, yet the end obj's tag property still seems to always be 0. So when I attempt to get the EndTag, it does not find it since the tag values do not match which is what TWPTextObj.GetEndTag looks for if the start tag value is non-zero. By forcing the start obj's Tag to be 0 using SetTag(0), my use of SelectionAsString works now since it has the proper values based on the start and end object's positions.

    I've emailed you about this (before I updated this thread) as to what the impact might be with me setting the bookmark's start obj tag value to 0, or if I missed a property setting somewhere. You can ignore the email if you prefer to respond here.

    Thanks,

    Eric

  • Thanks for looking at my file and finding that the bookmarks I have only have the name set on the start object. Your change to allow this corrects my issue, thank you!

    As for using mailmerge for bookmarks... I'm already doing this in a way. What I use bookmarks for is to mark text for use elsewhere in the generated report, such as for creating a summary of repair items the user marked as such. I currently use mailmerge to fill in what I call tags (I have tons of tags users can use). And the specific tag I use to pull all the linked text in is <$LinkedText:qualifier>. I examine the tag on a mailmerge to see what I have to replace the tag with. Mailmerge for this is awesome!