2015-Mar-26: RVF field type is added
2018-Apr-30: compatibility with TRichView 17.3. Unicode text in all versions of Delphi. Tab characters are allowed in text field values.
procedure DeleteTrailingBlankLines(RVData: TCustomRVData);
var i: Integer;
begin
for i := RVData.ItemCount-1 downto 1 do
if RVData.IsParaStart(i) and (RVData.GetItemStyle(i)>=0) and
(RVData.GetItemText(i)='') then
RVData.DeleteItems(i,1)
else
break;
end;
procedure TForm1.Button1Click(Sender: TObject);
var Stream: TStream;
ItemCount: Integer;
begin
Index := 0; // index of the current person
ItemCount := 0;
rvOutput.Clear;
while Index<Persons.Count do
begin
// copying rve to the end of rvOutput
Stream := TMemoryStream.Create;
rve.SaveRVFToStream(Stream, False);
Stream.Position := 0;
if Index = 0 then
rvOutput.InsertRVFFromStream(Stream, ItemCount)
else
rvOutput.AppendRVFFromStream(Stream, -1);
Stream.Free;
// processing the last added copy of template
if rvOutput.ItemCount>ItemCount then
begin
// replacing field codes
FillFields(rvOutput.RVData, ItemCount);
end;
ItemCount := rvOutput.ItemCount;
inc(Index);
end;
rvOutput.Format;
end;