Page 1 of 1

line break in cell

Posted: Thu Nov 10, 2016 8:50 am
by rellik
Hi! I need paste text into cell of table.

I use table1.cell[0, 0].addNL(s);

but if s = 'перенос '+#10#13+'строки'; SrichViewEdit ignore it and paste into cell 'перенос строки'

Posted: Thu Nov 10, 2016 9:25 am
by Sergey Tkachenko
To add multiline text, use AddTextNL:

Code: Select all

table.Cells[0,0].AddTextNL('line1'#10#13'line2', 0, 0, 0);

Posted: Thu Nov 10, 2016 10:24 am
by rellik
Thanks, I can see, how many lines in the text of the cell?

Posted: Thu Nov 10, 2016 10:47 am
by Sergey Tkachenko
I assume that "lines" means "paragraphs" (including line breaks inside paragraphs)

Code: Select all

function GetParaCount(RVData: TCustomRVData): Integer;
var i: Integer;
begin
  Result := 0;
  for I := 0 to RVData.ItemCount - 1 do
    if RVData.IsFromNewLine(I) then
      inc(Result);
end;

Call:
ParaCount := GetParaCount(table.Cells[0,0].GetRVData);