Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
How do I perform a mail merge into a table?
What I'd like to do is mail merge from my data source into a Word table.
So, in order to put more than one record on a page, I use the NEXT field code on each new row. The problem with this is that if I have 20 rows per page and, say, use only 15, there are now 5 blank, but outlined rows in my output document. It would of course be easy to remove these rows, but the entire merge process will be directed by an outside program for automation. So, I suppose my question is, is there a way to dynamically add rows to my table as records are needed? |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
How do I perform a mail merge into a table?
It's possible that instead of using a mailmerge, you could use a DATABASE
field (which, in essence, creates a table in Word from a table or query in a data source). You don't get a lot of control over the formatting of the result, but a. I suggest you have a look at this approach, even if it's just to rule it out b. you may be able to deal with some formatting problems by - formatting the results how you want then - including a \*Mergeformat switch in the DATABASE field c. DATABASE fields can sometimes be combined with a mailmerge in useful ways. For database fields, look at Word Help, and enable the Database toolbar (e.g. via Word Tools|Customize) and check the "Insert as field" option when you insert your data. Peter Jamieson "Polaris" wrote in message ... What I'd like to do is mail merge from my data source into a Word table. So, in order to put more than one record on a page, I use the NEXT field code on each new row. The problem with this is that if I have 20 rows per page and, say, use only 15, there are now 5 blank, but outlined rows in my output document. It would of course be easy to remove these rows, but the entire merge process will be directed by an outside program for automation. So, I suppose my question is, is there a way to dynamically add rows to my table as records are needed? |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
How do I perform a mail merge into a table?
Although that's probably a good idea, I really, really need to use mail
merge, since this document will be needed to be treated in the same way as labels and letters, in that they will be separate *.doc files, but will be merged against the same sources programatically in C#. |
#4
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
How do I perform a mail merge into a table?
Well, the other simple way to merge into a table is to do a
catalog/directory merge where you set up a single table row in your mail merge main document, with one merge field in each cell. But you haven't said how you are deciding where your output document is going to be split, because in that case, you just get one continuous table with no page breaks etc. The reason I suggested a DATABASE field is because when you want continuous tabular output of arbitrary length, that's the way to do it. If you need to do a merge, then consider using one data source for the merge, with one record for each "document" you want to produce, and use one DATABASE field in the mail merge main document that extracts the records related to the current record in the data source, typically using a key field nested in the SELECT query in the DATABASE field. E.g. your data source has records like sk stext 1 mytexta 2 mytextb 2 mytextc 3 mytextd 3 mytexte 3 mytextf etc. and you want documents with mytexta then mytextb mytextc then mytextd mytexte mytextf In that case, you can use a data source for the merge such as SELECT DISTINCT sk FROM mytable, then put a DATABASE field in your Mail Merge Main Document that does SELECT stext FROM mytable WHERE sk = { MERGEFIELD sk } (where { MERGEFIELD sk } is a merge field code and the {} are the special field braces you can insert using ctrl-F9) There are problems with this approach, e.g. in recent versions of Word MS code gets confused between the fields in the data source for the merge and the fields in tables in the DATABASE field, but you probably either need to be doing that, or "rolling your own merge" by inserting table rows as required using C#, in which case your current design won't work either. Peter Jamieson "Polaris" wrote in message ... Although that's probably a good idea, I really, really need to use mail merge, since this document will be needed to be treated in the same way as labels and letters, in that they will be separate *.doc files, but will be merged against the same sources programatically in C#. |
#5
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
How do I perform a mail merge into a table?
I tried the directory merge with a template and it put one row per page. Am I
missing something? |
#6
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
How do I perform a mail merge into a table?
See 'How to use mail merge to create a list sorted by category in Word
2002 - http://support.microsoft.com/?kbid=294686' which covers the basics of a directory merge used to list by groupings. Word is not really designed for this type of merge. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Polaris wrote: I tried the directory merge with a template and it put one row per page. Am I missing something? |
#7
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
How do I perform a mail merge into a table?
Yes, it probably didn't do what you want because so far you haven't told us
exactly what you want - although I think we probably guessed, and if we guessed correctly, the other suggestion I made should meet your needs. Peter Jamieson "Polaris" wrote in message ... I tried the directory merge with a template and it put one row per page. Am I missing something? |
#8
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
How do I perform a mail merge into a table?
That helped. Thanks a lot.
|
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Losing Mail Merge Items after I perform "Merge Option". | New Users | |||
Losing Mail Merge Items after I perform "Merge Option". | New Users | |||
Losing Mail Merge Items after I perform "Merge Option". | New Users | |||
Losing Mail Merge Items after I perform "Merge Option". | New Users | |||
Losing Mail Merge Items after I perform "Merge Option". | New Users |