Forum


Replies: 5   Views: 3160
Define width for table colums
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by nachtschicht  · 22-11-2011 - 19:46

Hi,

is there a way to define the width for a table column and second question would it be possible to give the L1 rows a different background color than the L2 rows?


[code]
require_once 'classes/CreateDocx.inc';

$docx = new CreateDocx();

$valuesTable = array(
array(
'L1',
'L1'
),
array(
'L2',
'L2'
),
);

$paramsTable = array(
'border' => 'single',
'border_sz' => 20
);

$docx->addTable($valuesTable, $paramsTable);

$docx->createDocx('example_table');
[/code]

Thanks for your help

Posted by admin  · 11-04-2013 - 12:13

Hello,

Please check examples/easyTable_size_cols.php and testTable_color.php files. Only available for phpdocx pro.

Regards.

Posted by nachtschicht  · 11-04-2013 - 12:13

Hi,

just got the sources and the activiation code however I am not able to locate the color example. Can you point me to the locations were this is suposed to stay?

Posted by nachtschicht  · 11-04-2013 - 12:13

... and another problem. When I apply the table width array as outlined in the Table_size_cols.php to a regular table - everythink works. If I try to apply it to a table like described in TableStyled.php it is beeing ignored.

For TableStyled liked tables only single values are exepted in the params array:

[code]
$docx_params_table_1 = array(
'border' => 'single',
'border_sz' => 2,
'border_spacing' => 0,
'border_color' => '000000',
'size_col' =>[b] 2500[/b]
);
[/code]

Arrays are not going to work:

[code]
$docx_params_table_1 = array(
'border' => 'single',
'border_sz' => 2,
'border_spacing' => 0,
'border_color' => '000000',
'size_col' => [b]array(3000,1500,1500)[/b]
);
[/code]

How can I apply different column width to styled tables?

Kind regards,

Posted by nachtschicht  · 11-04-2013 - 12:13

aha found the solution. I had an error in one of my style array's which did not raise an PHP - Error -> strange. But anyway fixing that error solved the width problem as well.

... I also found the Test - folder which contains examples of the undocumented "'cell_color' => 'FFFFFF'," paramanter which works as expected as well.