Forum


Replies: 4   Views: 3330
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.

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

One more thing on that.

When I print_r($table) the table array I'll finde the value [_xml:protected] filled with

<w:r><w:rPr><w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"></w:rFonts><w:sz w:val="22"></w:sz></w:rPr><w:t xml:space="preserve">TEST</w:t></w:r>__GENERATESUBR__

This value is not filled in the table array were the size_col values are applied. However I have no idea as to why this value is filled in on table...

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

Hello,

We'll check this issue to be solved on the next version of phpdocx.

Regards.

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

Hi,

when is the next version going to be released? Is there a way to fix that problem by patching the php-files?

Kind regards,
Johannes