0

I have created table using phpword. Cell 1 has border, cell 2 has no border. when I generate pdf, whole table come out with borders. I have use tcpdf renderer to generate pdf

<?php
include_once '../vendor/autoload.php';
$phpWord = new \PhpOffice\PhpWord\PhpWord();
use PhpOffice\PhpWord\Element\Table;
use PhpOffice\PhpWord\TemplateProcessor;
use PhpOffice\PhpWord\ComplexType\TblWidth;
use PhpOffice\PhpWord\Settings;
use PhpOffice\PhpWord\SimpleType\Border;
$styleCell1 = array('borderColor' =>'black', 'borderSize' => 6);
$styleCell2 = array('borderColor' =>'black', 'borderSize' => 0,'borderStyle' => Border::NONE);
$section = $phpWord->addSection();
$table = $section->addTable('testing');
//$table = new Table();

$table->addRow();
$table->addCell(700,$styleCell1)->addText('cell 1');
$table->addCell(500,$styleCell2)->addText('cell 2');
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('1411_testingTable.docx');
Settings::setPdfRendererPath('../vendor/tecnickcom/tcpdf');
Settings::setPdfRendererName(Settings::PDF_RENDERER_TCPDF);
$phpWord->save('1411_testingTable.pdf','PDF'); 

docx output:

enter image description here

pdf output : output

2
  • Try to color the border of cell 2 white, maybe that will help? Commented Nov 14, 2023 at 8:51
  • I have tried, still have border in pdf Commented Nov 15, 2023 at 3:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.