Why does TRichEdit insert line breaks that aren't in the RTF code when converting to plaintext?

StackOverflow https://stackoverflow.com/questions/16913805

سؤال

I have this RTF code:

{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang7\f0\fs22 Dies ist eine Textdatei mit einigen Umlauten und Sonderzeichen:\par
\'c4\'d6\'dc\'df\'ea\'80\'fb\'fa\'f9\par
}

The code I'm using (from this question):

class function TRTF.Decode(const AInput: string): string;
var
  RichEdit: TRichEdit;
  Stream: TStringStream;
begin
  RichEdit := CreateRichEdit;
  try
    Stream := TStringStream.Create(AInput);
    try
      RichEdit.Lines.LoadFromStream(Stream);
      Result := RichEdit.Lines.Text;
    finally
      Stream.Free;
    end;
  finally
    RichEdit.Free;
  end;
end;

I'm decoding it to plaintext and the result is:

Dies ist eine Textdatei mit 
einigen Umlauten und 
Sonderzeichen:
ÄÖÜßê€ûúù

I'm wondering why TRichEdit is inserting additional line breaks in the first paragraph?

Is there anything I can do to control this behavior?

هل كانت مفيدة؟

المحلول

Presumably this is because the default value for WordWrap is True. I expect that you can set it to False before you do your conversions.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top