首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用setColSpan()后添加文本的PHPPresentation不起作用

使用setColSpan()后添加文本的PHPPresentation不起作用
EN

Stack Overflow用户
提问于 2020-03-19 05:30:28
回答 1查看 75关注 0票数 0

我试图在colspan列后面添加文本,但是我尝试过的都不起作用。这是我到目前为止所尝试过的。

代码语言:javascript
复制
// 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';
}

结果如下所示:

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-03-19 06:13:35

看起来它已经将两个文本都放在了第一列,并设置了colspan2

因此,尝试将光标放到第三列/单元格中

代码语言:javascript
复制
$Cell = $row->getCell(2);
$Cell->createTextRun('Row 1 cololum 2');
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60747763

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档