5

Typical you would format auto height rows with PHPExcel like this:

$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__));

The problem is this doesn't work well when you open such a file with LibreOffice Calc. Instead you have to select the cell, choose Format Cells... and click OK.

It seems this is a known bug but unfortunately the proposed solution by adding the following else block into Classes\PHPExcel\Writer\Excel2007\Worksheet.php at line 1004 doesn't seem to work:

else {
    $objWriter->writeAttribute('customHeight', 'false');
    $objWriter->writeAttribute('ht', '0');
}

How could this be fixed?

witrin
  • 3,701
  • 1
  • 24
  • 49

1 Answers1

0

Seems like that's a known bug in Libre Office. Detailed discussion here: https://phpexcel.codeplex.com/discussions/429322

CoolEsh
  • 3,134
  • 1
  • 21
  • 24