empty line in cell

General TRichView support forum. Please post your questions here
Post Reply
King Cheung
Posts: 12
Joined: Fri Mar 23, 2012 2:08 am

empty line in cell

Post by King Cheung »

Hello,everyone! When i load cell content from xml and insert it to all cells in table, there will be an additional line in all cells. Before i use AddNL to insert the xmlstr, i have call Cell.Clear.However, an additional line still exist in all cells. Anybody can give me a hand?
I insert text in this way:

Code: Select all

if xmlstr <> '' then     
begin
  table.Cells[r,c].Clear;
  table.EditCell(r,c);  
  table.Cells[r,c].AddNL(xmlstr,0,-1);     
end;
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Do you want this operation to be undoable?

If not:

Code: Select all

if xmlstr <> '' then      
begin 
  table.Cells[r,c].GetRVData.Clear; 
  table.Cells[r,c].GetRVData.AddNL(xmlstr,0,0);      
end; 
// and when all is finished, call RichViewEdit.Format
If yes:

Code: Select all

if xmlstr <> '' then      
begin 
  table.Cells[r,c].Edit; 
  TCustomRVFormattedData(table.Cells[r,c].GetRVData).SelectAll;
  RichViewEdit1.ApplyTextStyle(0);
  RichViewEdit1.ApplyParaStyle(0);
  RichViewEdit1.InsertText(xmlstr);
end; 
King Cheung
Posts: 12
Joined: Fri Mar 23, 2012 2:08 am

Post by King Cheung »

hi Sergey£¬Your method works well. Thank you!
Post Reply