gpt4 book ai didi

phpexcel - LibreOffice Calc 中的自动高度

转载 作者:行者123 更新时间:2023-12-03 17:49:10 25 4
gpt4 key购买 nike

通常,您会像这样使用 PHPExcel 格式化自动高度行:

$file = new PHPExcel();
$file->getActiveSheet()->setCellValue('A1', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.');
$file->getActiveSheet()->getRowDimension(1)->setRowHeight(-1);
$file->getActiveSheet()->getStyle('A1')->getAlignment()->setWrapText(true);
$writer = PHPExcel_IOFactory::createWriter($file, 'Excel2007');
$writer->save(str_replace('.php', '.xlsx', __FILE__));

问题是当您使用 LibreOffice Calc 打开这样的文件时,这不起作用。相反,您必须选择单元格,选择 Format Cells...然后点击 OK .

看来这是一个 known bug但不幸的是,建议的解决方案是添加以下 else阻止进入 Classes\PHPExcel\Writer\Excel2007\Worksheet.php at line 1004似乎不起作用:
else {
$objWriter->writeAttribute('customHeight', 'false');
$objWriter->writeAttribute('ht', '0');
}

这怎么能解决?

最佳答案

似乎这是 Libre Office 中的一个已知错误。详细讨论在这里:https://phpexcel.codeplex.com/discussions/429322

关于phpexcel - LibreOffice Calc 中的自动高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25443761/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com