Mail Merge using your Master-Detail sample code...

General TRichView support forum. Please post your questions here
Post Reply
futuremode
Posts: 14
Joined: Tue Jan 11, 2011 7:38 pm

Mail Merge using your Master-Detail sample code...

Post by futuremode »

I am using code from your sample Master-Detail mail merge demo.

I notice when I analyse the tables for the related data on your demo I see the table name, columns and rows indicated 'Class 0 2' etc. due to you building the table at run time.

Thus your tables are:

('Class 0 2', -60, 0, [], [], nil, nil, 0, 0, -1, '', False, False, nil, (0, 0, 0, 0, (0, 0), (0, 0)), (nil,nil), (nil,nil), [rvtsInserted], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, $CA4060, 2, 2, 1, 1, 0, 0, -16777208, -16777211, 0, 0, 0, -16777208, -16777208, -16777208, rvtbRaised, rvtbLowered, 2, 2, False, False, -16777196, -16777196, -1, -1, 0, 0, 0, [rvtoEditing,rvtoRowSizing,rvtoColSizing,rvtoRowSelect,rvtoColSelect], [rvtoHalftoneBorders,rvtoRowsSplit], (False, 0, 0, 0, 0, 0, 0, nil), 0, 0, #$D#$A, #$D#$A, -1, -1, -1, -1, (nil,nil), 0, nil, '', $CB1A50, nil, $CBA560, nil, False, nil)

On mine as the user is adding the table row and data tags I end up with:

('', -60, 0, [], [], nil, nil, 0, 0, 0, '', False, False, nil, (0, 0, 0, 0, (0, 0), (0, 0)), (nil,nil), (nil,nil), [rvtsInserted,rvtsEditMode], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, $1BC66A0, 2, 2, 1, 1, 0, 1, -16777208, 536870911, 1, 0, 0, -16777208, -16777208, -16777208, rvtbColor, rvtbColor, 2, 2, False, False, -16777196, -16777196, -1, -1, 0, 0, 0, [rvtoEditing,rvtoRowSizing,rvtoColSizing,rvtoRowSelect,rvtoColSelect], [rvtoHalftoneBorders,rvtoRowsSplit], (False, 0, 0, 0, 0, 0, 0, nil), 0, 0, #$D#$A, #$D#$A, -1, -1, -1, -1, (nil,nil), 0, nil, '', $18C3A10, nil, $22E7F20, nil, False, nil)

How do I write the DB table, column and row number info into the Richview table ('', -60). I need to add it after the user has added the table and running the merge. I was going to use a tag to identify the DB table {Quote:QuoteTable}. Check for that and then add the info to the table so your code picks it up and processes the table data.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

This demo stores this information in the table's item name.
When adding or inserting the table, this is the first parameter of AddItem or InsertItem.
If this table is added using RichViewActions (TrvActionInsertTable), item name for table is defined in TrvActionInsertTable.ItemName property.

If you need to change this text later, you can use a code like this:

Code: Select all

var s: String;
    table: TRVTableItemInfo;
    rve: TCustomRichViewEdit;
begin
  if not RichViewEdit1.GetCurrentItemEx(TRVTableItemInfo, rve, TCustomRVItemInfo(table)) then
    exit;
  s := rve.GetItemText(table.GetMyItemNo);
  if InputQuery('Text','Text:',s) then
    rve.SetItemTextEd(table.GetMyItemNo, s);
end;
PS: item names are stored only in RVF, in RTF or HTML they are lost.
futuremode
Posts: 14
Joined: Tue Jan 11, 2011 7:38 pm

Post by futuremode »

Thanks Sergey
Post Reply