Forum


Replies: 4   Views: 3333
Table "size_col"
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  · 13-01-2012 - 13:11

Hi,

one of my docx files has two tables in it. One table consists of four cols and the other of five. The tables are build in the same way however the column size defined in the params get only applied in the second table.

# Params for both tables
[code]
$this->docx_params_table_1 = array(
'border' => 'single',
'border_sz' => 20,
'border_spacing' => 0,
'border_color' => '000000',
'size_col' => array(
1800,
5200,
1800,
1800
)
);

$this->docx_params_table_2 = array(
'border' => 'single',
'border_sz' => 2,
'border_spacing' => 0,
'border_color' => '000000',
'size_col' => array(
1200,
7000,
1000,
1600,
2500
)
);
[/code]

# table 1
[code]
$table = array();
$row = array();
$c1 = $this->docx_table_head_01;
$c1['0']['text'] = $this->ParseOutput($GLOBALS['t']->t("DOCX_LOR_Subject",$Project->Language));
$c2 = $this->docx_table_head_02;
$c2['0']['text'] = $this->ParseOutput($GLOBALS['t']->t("DOCX_LOR_List_of_Requirements",$Project->Language));
$c3 = $this->docx_table_head_02;
$c3['0']['text'] = "";
$c4 = $this->docx_table_head_02;
$c4['0']['text'] = "";
$row[] = $docx->addElement('addText', $c1);
$row[] = $docx->addElement('addText', $c2);
$row[] = $docx->addElement('addText', $c3);
$row[] = $docx->addElement('addText', $c4);
$table[] = $row;

$docx->addTable($table, $this->docx_params_table_1);
[/code]

#table 2
[code]
$table = array();
$row = array();
$c1 = $this->docx_table_td;
$c1['0']['text'] = $PA_count.".".$PAS_count.".".$Objective_count.".".$Requirement_count;
$c2 = $this->docx_table_td;
$c2['0']['text'] = $this->ParseOutput($obj->Requirement);
$c3 = $this->docx_table_td;
$c3['0']['text'] = "";
$c4 = $this->docx_table_td;
$c4['0']['text'] = "";
$c5 = $this->docx_table_td;
$c5['0']['text'] = "";

$row[] = $docx->addElement('addText', $c1);
$row[] = $docx->addElement('addText', $c2);
$row[] = $docx->addElement('addText', $c3);
$row[] = $docx->addElement('addText', $c4);
$row[] = $docx->addElement('addText', $c5);
$table[] = $row;
$docx->addTable($table, $this->docx_params_table_2);
[/code]

All params defined for table 1 get applied - except the size_col param. Any idea as to why this is the case? I can't find any error in my code and the generated array's look good as well.