Page 1 of 1
Change Item's TextStyle
Posted: Sun Mar 02, 2014 9:37 am
by mohsen24000
Hi,
How can i change item's textstyle without ApplyTextStyle!?
for example, I want to change textstyle of all items that textstyleno=1 to 0.
thanks a lot.
Posted: Sun Mar 02, 2014 6:57 pm
by Sergey Tkachenko
Code: Select all
procedure ChangeTextStyle(RVData: TCustomRVData; FromStyleNo, ToStyleNo: Integer);
var i,r,c: Integer;
table: TRVTableItemInfo;
begin
for i := 0 to RVData.ItemCount-1 do
if RVData.GetItemStyle(i)=FromStyleNo then begin
[color=blue]RVData.GetItem(i).StyleNo := ToStyleNo[/color]
else if RVData.GetItemStyle(i)=rvsTable then begin
table := TRVTableItemInfo(RVData.GetItem(i));
for r := 0 to table.Rows.Count-1 do
for c := 0 to table.Rows[r].Count-1 do
if table.Cells[r,c]<>nil then
ChangeTextStyle(table.Cells[r,c].GetRVData, FromStyleNo, ToStyleNo);
end;
end;
Call:
Code: Select all
ChangeTextStyle(RichViewEdit1.RVData, 1, 0);
RichViewEdit1.ClearUndo; // this method cannot be undone
RichViewEdit1.Format;
Posted: Mon Mar 03, 2014 5:24 am
by mohsen24000
Thank you again