How to insert the RVF in the same line as the field?Sergey Tkachenko wrote: ↑Tue May 05, 2009 1:37 pm MainMerge-Text4
mailmerge-text4.zip
The same as MailMerge-text3, but supports several types of field values.
Field codes: text in {}, for example {NAME}.
Field values: multiline text / picture / table / arbitrary document (RVF)
[Demos] Mail Merge
Re:
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Re:
See MailMerge-Text4 demo: https://www.trichview.com/forums/viewto ... 707#p12707
Re: Re:
This is the MailMerge-Text4 demo.Sergey Tkachenko wrote: ↑Wed Nov 15, 2023 7:17 amSee MailMerge-Text4 demo: https://www.trichview.com/forums/viewto ... 707#p12707
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: [Demos] Mail Merge
Oh, sorry.
But I do not understand the question.
In this demo, the field content (RVF or text) is inserted in the line that contains field code.
You edited the template so that it contains a single line, so RVF field is inserted in this line.
(this demo repeats the result for each line in Persons.txt)
But I do not understand the question.
In this demo, the field content (RVF or text) is inserted in the line that contains field code.
You edited the template so that it contains a single line, so RVF field is inserted in this line.
(this demo repeats the result for each line in Persons.txt)
Re: [Demos] Mail Merge
I would like to insert the RVF at the end of the template line and not on a new line...
I can adapt this function to only remove the last blank line.
I can adapt this function to only remove the last blank line.
I don't think it's very elegant, is there any other way to do this?Sergey Tkachenko wrote: ↑Wed Nov 02, 2005 9:19 pm Modification of DeleteBlankLines - removing blank lines only from the end of the document:
Call:Code: Select all
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;
Code: Select all
DeleteBlankLines(RichViewEdit1.RVData); RichViewEdit1.ClearUndo; RichViewEdit1.Format;
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: [Demos] Mail Merge
So, you want to add the first paragraph of each record to the last paragraph of the previous record?
Change TForm1.Button1Click. The key method is AppendRVFFromStream(..., -1).
Change TForm1.Button1Click. The key method is AppendRVFFromStream(..., -1).
Code: Select all
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;