PHP Classes

Table Col Width, SpanCol and MS Word Print Layout

Recommend this page to a friend!

      MsDoc Generator  >  All threads  >  Table Col Width, SpanCol and MS Word...  >  (Un) Subscribe thread alerts  
Subject:Table Col Width, SpanCol and MS Word...
Summary:Enhanced to allow for different table col width and colspan
Messages:3
Author:John Sheffield
Date:2015-01-19 03:02:35
 

  1. Table Col Width, SpanCol and MS Word...   Reply   Report abuse  
Picture of John Sheffield 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.

  2. Re: Table Col Width, SpanCol and MS Word...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-01-19 04:42:35 - In reply to message 1 from John Sheffield
You may as well submit your version with a new name, a compatible license, but stating you derived your work from the original author's work.

  3. Re: Table Col Width, SpanCol and MS Word...   Reply   Report abuse  
Picture of Richy Luk Richy Luk - 2015-09-07 07:29:05 - In reply to message 1 from John Sheffield
Hi John,

Please send me a copy of your class to richyluk@gmail.com

Many thanks!