PHPSpreadsheet setAutoSize 函数未按预期工作
我正在使用 PHPSpreadsheet 并且我正在执行以下操作来自动调整相关列的
foreach (range('A', 'K') as $col) {
$productsSheet->getColumnDimension($col)->setAutoSize(true);
}
大小 :然而,添加了额外的填充。
以下是我使用 setAutoSize
函数使用自动调整大小时的情况:
这是在 Excel 中执行自动调整大小后的结果:
对于较宽的单元格,它变得更加突出,从而使导出的范围比需要的范围宽得多。
有什么办法可以解决这个问题吗?手动设置每列的宽度对我们来说是不可接受的,因为内容变化很大。
I am using PHPSpreadsheet and I'm doing the following to autosize the relevant columns:
foreach (range('A', 'K') as $col) {
$productsSheet->getColumnDimension($col)->setAutoSize(true);
}
The issue is, however, that extra padding is added.
The following is when I use autosize with using the setAutoSize
function:
And here it is after doing the autosize in Excel:
It becomes even more prominent for wider cells thus making the export far wider than it needs to be.
Is there anything that can be done about this, manually setting the width of each column is not acceptable for us as the content is highly variable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论