Forum


Replies: 1   Views: 157
Top and bottom table cell margins using native docx to pdf
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 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]);