Forum


Replies: 1   Views: 71
Top and bottom table cell margins using native docx to pdf

Posted by jlw98r  · 10-10-2024 - 09:02

In PhpDocx 15.5 Premium, when I add cell margins to a table the top and bottom margins appear in the DOCX but are lost when transforming to a PDF with the native plugin. The left and right margins appear as expected. How to I change the top and bottom table cell padding for a PDF using the native plugin?

Here is some example code using 'cellMargin' => 400, but the same happens if I set it using individual keys, e.g. 'cellMargin' => ['top' => 400, 'bottom' => 400].

$tableValues = [
    ['One', 'Two'],
    ['Three', 'Four'],
    ['Five', 'Six']
];

$tableParams = array(
    'cellMargin' => 400,
);

$docx = new CreateDocx();
$docx->addTable($tableValues, $tableParams);
$docx->createDocx('example.docx');
$dompdf = new Dompdf();
$transform = new TransformDocAdvNative();
$transform->transformDocument('example.docx', 'example.pdf', ['dompdf' => $dompdf]);