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.
Change Item's TextStyle
-
- Site Admin
- Posts: 17565
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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;
Code: Select all
ChangeTextStyle(RichViewEdit1.RVData, 1, 0);
RichViewEdit1.ClearUndo; // this method cannot be undone
RichViewEdit1.Format;