PHPPresentation 在使用 setColSpan() 后添加文本不起作用
PHPPresentation Adding Text After Using setColSpan() Doesn't Work
我尝试在 colspan 列之后添加文本,但我尝试过的任何方法都没有奏效。这是我到目前为止尝试过的方法。
// Create a shape (table)
$tableShape = $currentSlide->createTableShape(3);
$tableShape->setHeight(1200);
$tableShape->setWidth(960);
$tableShape->setOffsetX(0);
$tableShape->setOffsetY(0);
// Add row
$row = $tableShape->createRow();
$cell = $row->nextCell();
$cell->setColSpan(2);
$cell->createTextRun('Row 1 Colspan cololum 1');
$Cell = $row->nextCell();
$Cell->createTextRun('Row 1 cololum 2');
// Add row
echo date('H:i:s') . ' Add row'.EOL;
$row = $tableShape->createRow();
$oCell = $row->nextCell();
$oCell->createTextRun('R2C1');
$oCell = $row->nextCell();
$oCell->createTextRun('R2C2');
$oCell = $row->nextCell();
$oCell->createTextRun('R2C3');
// Save file
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}
结果如下:
看起来它已将两个文本都放在第一列并设置了 colspan2
所以试试这个把光标放到第三个column/cell
$Cell = $row->getCell(2);
$Cell->createTextRun('Row 1 cololum 2');
我尝试在 colspan 列之后添加文本,但我尝试过的任何方法都没有奏效。这是我到目前为止尝试过的方法。
// Create a shape (table)
$tableShape = $currentSlide->createTableShape(3);
$tableShape->setHeight(1200);
$tableShape->setWidth(960);
$tableShape->setOffsetX(0);
$tableShape->setOffsetY(0);
// Add row
$row = $tableShape->createRow();
$cell = $row->nextCell();
$cell->setColSpan(2);
$cell->createTextRun('Row 1 Colspan cololum 1');
$Cell = $row->nextCell();
$Cell->createTextRun('Row 1 cololum 2');
// Add row
echo date('H:i:s') . ' Add row'.EOL;
$row = $tableShape->createRow();
$oCell = $row->nextCell();
$oCell->createTextRun('R2C1');
$oCell = $row->nextCell();
$oCell->createTextRun('R2C2');
$oCell = $row->nextCell();
$oCell->createTextRun('R2C3');
// Save file
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}
结果如下:
看起来它已将两个文本都放在第一列并设置了 colspan2
所以试试这个把光标放到第三个column/cell
$Cell = $row->getCell(2);
$Cell->createTextRun('Row 1 cololum 2');