John Sheffield - 2015-01-19 03:02:35
Hi All,
As we all probably realize this class has not been maintained for some time. That does not take away from the fact it is still a very good class, light weight and not complicated. I have had the need to modify this class to serve two purposes. To allow for different table column sizes and to perform a colspan in tables. While at the same time I wanted to add an enhancement offered by Steve (his posted response 11-01-2012) in response to a post on 01-21-2010 addressing Print Layout as the default for MSWord.
I added the following two elements at the end of the addTableRow() array in clsMsDocGenerator.php.
$tdWidth - an array with the number of elements equal to the number of cells in the table. The values in each $tdWidth element is equal to the column width as normally specified in a <td> tag. You can use percentage but I have had very little luck doing so and have not spent the time to figure out why. I would stay with the simple numeric value. If you use this element you must set a column width for each cell. If you don't use this element, the class with respond the same way it always has – equal spacing for all cells.
$colSpan is the last element in the addTableRow() array. It is also an array with the number of elements equal to the number of cells in the table. You must follow the span number with blank quotes for the number of columns that are being spanned. Example – if the first column of a six column table were to span three columns the $colSpan value would be ('3','','','','','').
If you would like my version of clsMsDocGenerator.php, I will be more than happy to email a zipped copy at your request. Just reply to this post which should send me an email. Or try a private message.