I am testing TRichViewEdit, and I encountered an issue where it seems to add an unwanted line break at the first line. Below is the code I used for testing:
Code: Select all
procedure TForm17.FormShow(Sender: TObject);
var
LTextString:TStringstream;
begin
LTextString:= TStringstream.create;
try
LTextString.WriteString(
'{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1036{\fonttbl{\f0\fnil\fcharset0 Calibri;}}'
+'{\*\generator Riched20 10.0.22621}\viewkind4\uc1'
+'\pard\sa200\sl276\slmult1\f0\fs22\lang12 Line 1\par'
+'}'
);
LTextString.Position:=0;
RichViewEdit1.LoadRTFFromStream(LTextString);
RichViewEdit1.ReformatAll; // same with RichViewEdit1.Reformat
finally
LTextString.free;
end;
end;
I am attaching a screenshot and the full source code for reference.
Environment:
Delphi 11.3 and 12.2 VCL
TRichView version 23
Could you please let me know why this happens and how to resolve it?