I've reviewed the mail merge demos and I have some questions and am in need of some advice. In my application the mail merge template is provided by the customer as an RTF file with the appropriate field names tagged between []s. One of the fields I need to merge is a tStringGrid from one of my applications forms. A complication is I've taken over the CellDraw event for the tStrigGrid so the background color of the cell is a function of the text. So it's not a straight text merging problem.
What's the best way to get this data into a tRichView so I can print it? If I wanted to put two tStringGrids side by side in the document would it be best to use TextBoxs around them or maybe stick them into a two cell table?
Would it be easier just to grab the tStringGird canvas and merge in the data as graphics images?
Any recommendations would be appreciated.
Mail Merging a tStringGrid into a tRichView
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
So i went down this path. I can build a TRVTableItemInfo with the data from my StringGrid but I can't figure out how to insert it into my tRichView. Here's the snippet of code from the mail merge demo
FieldName := Copy(s, j+1, FieldEnd-j-1);
FieldValue := GetFieldValueFromDatabase(FieldName);
Delete(s, j, FieldEnd-j+1);
Insert(FieldValue, s, j);
Which I've turned into this for a simple test
FieldName := Copy(s, j+1, FieldEnd-j-1);
Delete(s, j, FieldEnd-j+1);
if FieldName = 'MyStringSridField' then
begin
// Build TRVTableItemInfo
atable := TRVTableItemInfo.CreateEx(3,3, RVData);
// Fill in the Cells
// Some uninteresting code
// How do I insert it???
end
else
begin
FieldValue := GetFieldValueFromDatabase(FieldName);
Insert(FieldValue, s, j);
end;
My table data doesn't show up in my Richedit. I can do a richedit.additem('',atable) and the data shows up but at the end of the document not where the mailmerge fieldname was.
FieldName := Copy(s, j+1, FieldEnd-j-1);
FieldValue := GetFieldValueFromDatabase(FieldName);
Delete(s, j, FieldEnd-j+1);
Insert(FieldValue, s, j);
Which I've turned into this for a simple test
FieldName := Copy(s, j+1, FieldEnd-j-1);
Delete(s, j, FieldEnd-j+1);
if FieldName = 'MyStringSridField' then
begin
// Build TRVTableItemInfo
atable := TRVTableItemInfo.CreateEx(3,3, RVData);
// Fill in the Cells
// Some uninteresting code
// How do I insert it???
end
else
begin
FieldValue := GetFieldValueFromDatabase(FieldName);
Insert(FieldValue, s, j);
end;
My table data doesn't show up in my Richedit. I can do a richedit.additem('',atable) and the data shows up but at the end of the document not where the mailmerge fieldname was.
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
http://www.trichview.com/support/files/ ... -text4.zip demo supports the following field values: text, picture, table.
Thanks. That's works great but it gets me back to one of my original questions.
" If I wanted to put two tStringGrids side by side in the document would it be best to use TextBoxs around them or maybe stick them into a two cell table?
So I tried the two cell table and it worked but I can't get Trichview to read my RTF template with Text Boxes. The texxtbox and the text inside isn't displayed. So I just tried a simple LoadRTF() with the same result.
Doesn't the latest version of tRichview support text boxes?
" If I wanted to put two tStringGrids side by side in the document would it be best to use TextBoxs around them or maybe stick them into a two cell table?
So I tried the two cell table and it worked but I can't get Trichview to read my RTF template with Text Boxes. The texxtbox and the text inside isn't displayed. So I just tried a simple LoadRTF() with the same result.
Doesn't the latest version of tRichview support text boxes?
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Colum Widths in mail-merged tStringGrid
I'm finally getting back to this after a brief layoff.
So as I mentioned previously I'm getting the stringgrids place correctly on the page inside some table cells that describe the layout of the stringgrids relative to each other.
My new problem is that TRichView is automatically changing the widths of the columns to fit into the cells. Is there a way to change this behavior to keep the relative size of all the columns constant?
So as I mentioned previously I'm getting the stringgrids place correctly on the page inside some table cells that describe the layout of the stringgrids relative to each other.
My new problem is that TRichView is automatically changing the widths of the columns to fit into the cells. Is there a way to change this behavior to keep the relative size of all the columns constant?
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: