OpenOffice Row Heights

Topics: Developer Forum, User Forum
Sep 17, 2009 at 5:52 AM

I'm running OpenOffice 3.0.1 and PHPExcel 1.7

The row height in OpenOffice doesn't seem to adjust to suit font size or text wrapping.

I can set the default font size to 20. But the row height will be the same as if I set it to 10. Similarly with text wrapping.

The row height value is set at -1 which seems correct. And I've tried setting it again to -1.

As in this thread: http://phpexcel.codeplex.com/Thread/View.aspx?ThreadId=66215

Developer
Sep 17, 2009 at 9:51 AM

Can you try with latest source code instead of PHPExcel 1.7.0 ?

http://phpexcel.codeplex.com/SourceControl/ListDownloadableCommits.aspx

Sep 21, 2009 at 1:38 AM

Same issue with the latest source code. Running this code:

<?php
require('PHPExcel.php');
require('PHPExcel/IOFactory.php');

$phpexcel = new PHPExcel();
$phpexcel->getDefaultStyle()->getFont()->setSize(20);
$worksheet = $phpexcel->getActiveSheet();

$worksheet->getStyle('A1')->getAlignment()->setWrapText(true);
$worksheet->setCellValue('A1',"Oh Hai!\nThis is\nMultiple\nLines");
$worksheet->getRowDimension(1)->setRowHeight(-1);

$objWriter = PHPExcel_IOFactory::createWriter($phpexcel, 'Excel2007');
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="Test.xlsx"');
header('Cache-Control: max-age=0');
$objWriter->save('php://output');
?>
Doesn't change the height to suit the font size or the multiple lines.

Developer
Sep 21, 2009 at 2:19 AM

Hmm.. I cannot reproduce this with the latest source code.

OpenOffice.org 3.1.1 with xlsx output:



OpenOffice.org 3.1.1 with xls output:

Maybe my OpenOffice.org is newer than yours? I weakly recall that OpenOffice.org 3.0.x had some problems with row heights in Excel files that disappeared when I upgraded to version 3.1.0.

Sep 21, 2009 at 3:03 AM

I've just upgraded to version 3.1.1 and am no longer having the issue.

Thank you!