I try to create simple template editor. I load in RichView text like this:
Hello. My name #NAME. I am #AGE years old.
After load to RichView in text I must replace variables #NAME and #AGE to emply text items. Text will be protected, variables - not! How can i do this?
I tried to use example from help:
Code: Select all
procedure TForm1.Search(ARVData: TCustomRVData);
var
I, N, R, C, StyleInd, ItemStyle: Integer;
S: string;
VName, AItemText: string;
B: Boolean;
Table: TRVTableItemInfo;
RVEditData: TRVTableCellData;
begin
i := 0;
repeat
ItemStyle := ARVData.GetItemStyle(i);
if ItemStyle >= 0 then // text item
begin
AItemText := ARVData.GetItemText(I);
N := Pos('#',AItemText); // if var exists
if N > 0 then
begin
B := ExctractVariable(AItemText,VName); // get var. name
if B do
begin
if var is at the start text item then i insert empty before current item;
if var is at the end text item then i add empty after current item;
if var is in text item then i devide current item to two and insert empty text item between them.
How can i do this?
end;
end;
I := I + 1;
until
I = ARVData.ItemCount;
end