Hi guys,
I'm using PHPDOCX version 4.0. I'm trying to show header with the text on the left and an image on the right. My idea is that I add a table with two column, set border: none and add the text to the left cell, and the image on the right cell. You can see my code below:
$docx = new CreateDocx();
//we create a few Word fragments to insert rich content in a table
$dateFragment = new \WordFragment($docx);
$imageFragment = new \WordFragment($docx);
$headerFragment = new \WordFragment($docx, 'defaultHeader');
$dateFragment->addText(array(array(
'text' => date('d/m/Y'),
'fontSize' => 11,
'font' => 'Calibri'
)));
$imageOptions = array(
'src' => 'full_screen_image.jpg',
'dpi' => 300,
'width' => 300,
'height' => 200,
'imageAlign' => 'right'
);
$imageFragment->addImage($imageOptions);
$valuesTable = array(
array(
$dateFragment,
$imageFragment
)
);
$paramsTable = array(
'tableAlign' => 'center',
'columnWidths' => array(4500, 4500),
'border' => 'none'
);
$headerFragment->addTable($valuesTable, $paramsTable);
$docx->addHeader(array('default' => $headerFragment));
$docx->createDocx('example_addTable_2');
But in my result docx file, the image cannot be shown. You can check my screenshot in the following link:
Please help me to figure out the reason why this issue happen, and how we can resolve it.
Thank you.