Text with ansi code in table cells
Posted: Fri Aug 04, 2006 12:44 pm
Can someone help me please.
I have 2 questions:
1) why cant i load an rtf file made by MS Word
2) i made a procedure wich searches a table for some words and when a specific word is found the text has to be replaced
I made the following procedure:
procedure TForm1.SearchDocument;
var item: TCustomRVItemInfo;
table: TRVTableItemInfo;
Data: Integer;
r,c,cs,rs,i: Integer;
rv: TCustomRichViewEdit;
ItemNo: Integer;
s,s1,s2,s3:string;
p:tstringlist;
begin
if not rve.GetCurrentItemEx(TRVTableItemInfo, rv, item) then
exit;
table := TRVTableItemInfo(item);
ItemNo := rve.GetItemNo(table);
for r:= 0 to table.Rows.Count -1 do
for c:= 0 to table.Rows[r].Count -1 do
begin
for i:= 0 to table.Cells[r,c].ItemCount -1 do
begin
s := Replace(table.Cells[r,c].GetItemText(i),rve,i);
s1:= Replace(s,rve,i);
s2:= Replace(s1,rve,i);
s3:= Replace(s2,rve,i);
// showmESSAGE('S '+S);
// showmESSAGE('S1 '+S1);
// showmESSAGE('S2 '+S2);
// showmESSAGE('S3 '+S3);
table.Cells[r,c].SetItemTextA(i,s3); // gives s3 as a long
string and
// ansi code #13#10 or #9 does not work
table.Cells[r,c].AddTextNLA(s3,0,-1,0); // goes wel with ANSI code
end;
rve.format;
end;
uReportShared.formatTable(9,table);
end;
However i need the procedure wich doesnt work:
table.Cells[r,c].SetItemTextA(i,s3); so the text is replaced
Please can someone help me[/b]
I have 2 questions:
1) why cant i load an rtf file made by MS Word
2) i made a procedure wich searches a table for some words and when a specific word is found the text has to be replaced
I made the following procedure:
procedure TForm1.SearchDocument;
var item: TCustomRVItemInfo;
table: TRVTableItemInfo;
Data: Integer;
r,c,cs,rs,i: Integer;
rv: TCustomRichViewEdit;
ItemNo: Integer;
s,s1,s2,s3:string;
p:tstringlist;
begin
if not rve.GetCurrentItemEx(TRVTableItemInfo, rv, item) then
exit;
table := TRVTableItemInfo(item);
ItemNo := rve.GetItemNo(table);
for r:= 0 to table.Rows.Count -1 do
for c:= 0 to table.Rows[r].Count -1 do
begin
for i:= 0 to table.Cells[r,c].ItemCount -1 do
begin
s := Replace(table.Cells[r,c].GetItemText(i),rve,i);
s1:= Replace(s,rve,i);
s2:= Replace(s1,rve,i);
s3:= Replace(s2,rve,i);
// showmESSAGE('S '+S);
// showmESSAGE('S1 '+S1);
// showmESSAGE('S2 '+S2);
// showmESSAGE('S3 '+S3);
table.Cells[r,c].SetItemTextA(i,s3); // gives s3 as a long
string and
// ansi code #13#10 or #9 does not work
table.Cells[r,c].AddTextNLA(s3,0,-1,0); // goes wel with ANSI code
end;
rve.format;
end;
uReportShared.formatTable(9,table);
end;
However i need the procedure wich doesnt work:
table.Cells[r,c].SetItemTextA(i,s3); so the text is replaced
Please can someone help me[/b]