PHPWord icon indicating copy to clipboard operation
PHPWord copied to clipboard

Table ignores gridSpan

Open e1sep0 opened this issue 5 years ago • 2 comments

Hello, i try to make such table: image

My code:

$phpWord = new PhpWord();
        $section = $phpWord->addSection();
        $headerStyle = ['size' => 16, 'bold' => true];
        $boldStyle = ['bold' => true];
        $tableStyle = ['borderSize' => 1];
        $cellRestartSpan = ['vMerge' => 'restart', 'gridSpan' => 2];
        $cellContinueSpan = ['vMerge' => 'continue', 'gridSpan' => 2];
        $cellColSpan = ['gridSpan' => 2];

        $section->addText('Наклейка', $headerStyle, ['alignment' => JcTable::CENTER]);
        $table = $section->addTable($tableStyle);

        $table->addRow();
        $table->addCell(1000)->addText('Откуда: ', $boldStyle);
        $table->addCell(4000)->addText('');
        $table->addCell(5000, $cellRestartSpan);

        $table->addRow();
        $table->addCell(1000)->addText('От кого: ', $boldStyle);
        $cell = $table->addCell(4000);
        $cell->addText('');
        $cell->addText($postForm->getSender()->translate()->getFullname());
        $table->addCell(5000, $cellContinueSpan);

        $table->addRow();

        $table->addCell(5000, $cellColSpan);
        $table->addCell(1000)->addText('Куда: ', $boldStyle);
        $table->addCell(4000)->addText($postForm->getAddress());

        $table->addRow();
        $table->addCell(5000, $cellColSpan);
        $table->addCell(1000)->addText('Кому: ', $boldStyle);
        $table->addCell(4000)->addText($postForm->getFio());

But rows in down ignores gridSpan: image

Please help)

e1sep0 avatar Jan 18 '21 15:01 e1sep0

I am having a similar issue.

JF-626164 avatar Apr 11 '22 14:04 JF-626164

In 2022, I also found this problem.

yinbug avatar Sep 16 '22 02:09 yinbug