Auto Height in LibreOffice Calc

Typically, you should format strings with auto-height using PHPExcel as follows:

$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 that this does not work when you open such a file with LibreOffice Calc. Instead, you should select a cell, select Format Cells... and click OK .

This seems to be a known bug , but unfortunately the proposed solution, adding the following else block to Classes\PHPExcel\Writer\Excel2007\Worksheet.php on line 1004 doesn't seem to work:

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

How can this be fixed?

+5
source share
1 answer

It seems like a known bug in Libre Office. Detailed discussion here: https://phpexcel.codeplex.com/discussions/429322

0
source

Source: https://habr.com/ru/post/1200912/


All Articles