Page 1 of 1

empty line in cell

Posted: Fri Mar 23, 2012 2:44 am
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;

Posted: Fri Mar 23, 2012 3:08 pm
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; 

Posted: Sun Mar 25, 2012 1:56 am
by King Cheung
hi Sergey£¬Your method works well. Thank you!