Hello,
So, I'm reading in addTable api-document, that we can set value of tableData to word fragment, here the explanation:
value -> mixed -> The text to be inserted (string) or a Word fragment if we want to insert complex paragraphs, images, nested tables, ...
so, I try to make it, like this:
$wf = new WordFragment($docx, 'document');
$wfTable = new WordFragment($docx, 'document');
$text = array(
'text' => 'Hello',
'bold' => true
);
$prop = array(
'textAlign' => 'center'
);
$wfTable->addText($text, $prop);
$table[] = array(
array(
'value' => $wfTable,
'backgroundColor' => '0022cc'
),
array(
'value' => 'some text',
'backgroundColor' => '0022cc'
)
);
$wf->addTable($table);
assume that I already declare everything before.
But the result is corrupted document, I'm using free phpdocx, could anyone pell tell me what happend? or how could I fix it?