如何在 phpword 中为表格设置固定宽度(自动调整:固定列宽)

How to set fixed width for tables in phpword (auto fit : fixed column width)

我使用的是 phpword 版本 0.12.0。我在管理单元格内写入大量内容时遇到问题。即使单元格有一些固定的宽度,如果内容太大(在字符之间没有 space 的情况下),单元格布局就会被破坏。 (请看图)

有人知道怎么解决吗?

使用CSS:

td { overflow-x: hidden; text-overflow: ellipsis; }

在当前版本 (0.13) 中,我想你应该自己断开字符串。 参见:https://phpword.readthedocs.io/en/latest/styles.html#table.