addText to TextArea in RTF-Format

That is not correct. RTF ignores EndOfLine. If you want a linebreak, use \par.

1 Like

\par did not work for me. Backslash did.

I don’t know what you’re trying to achieve, but EOL is just whitespace in RTF. You should do some reading on what the RTF specification actually is, it is very well documented (as a simple google search will show you). You might start with

https://en.wikipedia.org/wiki/Rich_Text_Format

where, among other things, you’ll see the proper way to specify a linebreak:

{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard
This is some {\b bold} text.\par
}

The Backslash (also know as the escape character) is a special character. It needs something after it (even another Backslash).

You have a link to the RTF Language Reference (*).

You can also do it by yourself:
On Windows, create a simple text with two lines with Wordpad (for example), and load it as text elsewhere.

On macOS, use TextEdit dans do the same.

Then you have a sure understanding / result.

(*) Search the sentence below in the RTF LR:



Insert Special Character and Perform Action The reader inserts into the document the character code or codes described in the table entry and performs whatever other action the entry specifies. For example, when Microsoft Word interprets **\par**, a paragraph mark is inserted in the document and special code is run to record the paragraph properties belonging to that paragraph mark.

Thanks Jonathan. I really try to wrap my head around RTF. But to me it seems a lot like trial and Error. Writing a string to an RTF-file and reading that file again in Xojo to a TextArea.StyledText.RTFData, I found that backslash was working and \par did not. I don’t know why but since it is working, I don’t touch it again.