Home |
Search |
Today's Posts |
#1
|
|||
|
|||
How to merge data into a table and keep it's contents in line
Dear All
Our company uses Word to create documents using mailmerges. These documents include data which must be diplayed in a table. An example of this would be a table on an invoice displaying product code quantity and price. Currently we create a .dat file from our software and use a macro to merge this into a predesigned template. We would create a table with two rows and three columns, one row being for the heading and on for the actual data. The actual dat file will contain each column, seperated by carraige returns. When the merge takes place all the data for a given merge field appears in one cell, in a single row (although each column is split up correctly). For example... (please diplay this in a fixed pitch font such as courier) ------------------------ |Code | Price| Quantity| ------------------------ |AAAA |11.11 |123456.78| |BBBB |22.22 |123456.78| |CCCC |33.33 |123456.78| |DDDD |44.44 |123456.78| |EEEE |55.55 |123456.78| |----------------------| The problem we need to overcome is that if a a given line is longer than a column width permits then word will automatically insert a carriage return, resulting in the data going out of line with one another. For Example... ------------------------ |Code | Price| Quantity| ------------------------ |AAAA |11.11 |123456.78| |AA |22.22 |123456.78| |BBBB |33.33 |123456.78| |CCCC |44.44 |123456.78| |DDDD |55.55 |123456.78| |EEEE | | | |----------------------| In the above example, AAAA was extended to AAAAAA which did not fit. This caused the rest of the data in the cell to be shifted down a line, and the respective prices and quantities are no longer in line with one another. I suspect that we need to use seperate lines, or rows for each line to make this work correctly. Is there a way to do this when merging into a table? If so, what control characters do we need to use to define the start and finish of each line? Is there a character you can use in a merge data file which will tell the table to create a new row and to move to it? I am sure there is a sensible way of doing what we are trying, please can you help. Regards / TYIA James WJ Buttle MSFT Certified Professional |