Extract text of limited line length

  • I am using a TDBWPRichText component to access some RTF in a database. I want to extract lines of plain text from this, but want each line length to be no more than 80 characters. So I set WordWrap to False in the component, and set PageWidth in the Header property to 80. Then I use this code to get the text out of the editor: TextString:=RichTextEditor.AsAnsiString('ANSI', false, false); When I search TextString for CRLF combinations I can extract the separate plain text lines. This works, but it returns some lines of greater than 80 characters length, that is, there can be more than 80 characters of text between the CRLF combinations. Is there an easy way to extract the text in strings no greater than 80 characters in length? Thanks much for any help with this!

    • Offizieller Beitrag

    There is no direct way to save the soft line breaks when extracting the text.

    But you can use code like this: