views:

310

answers:

1

How can i make rows a bid longer? if i output the excel all prints fine, only if the title is a bit long, then the Title is not readable. How can i fix that?

+2  A: 

It's probably the column width that needs fixing then.

Excel hides any content in a cell that runs wider than the column width it is in. It's just like CSS overflow property. Usually that is indicated by a small icon on the right hand side of the cell. Double clicking the right edge of the column will autoexpand the column. To have it visible right from the start, you'd have to increase the column width.

Example taken from this newsgroup entry

// Creating a workbook
$workbook = new Spreadsheet_Excel_Writer();

//Setting column width
$worksheets1->setColumn(0,0,10.00);

Quoting the same entry (fixed spelling):

This example breakdown is as follows...
setColumn(0,0,10.00) == the first column to be affected by the width
setColumn(0,0,10.00) == the last column to be affected by the width
setColumn(0,0,10.00) == the width as a float

The setColumn() needs to be set before any data is being written to the spreadsheet. If you only want one column to be affected by setColumn() then you set the first and last column params to the same column number. If you want to affect more than one column you can set the last column to the desired column number, just remember the column numbering begins with a 0.

In case that's not working with the PEAR package, try PHPExcel

Gordon
what about something like this<?php show/hide quoted text$style = $this->addFormat();$style->setSize(20);$style->setBold();$style->setHAlign('left');$style->setVAlign('vcenter');// function setMerge($first_row, $first_col, $last_row, $last_col) show/hide quoted text$style->setMerge(0, 0, 0, 9);show/hide quoted text$sheet->write(0, 0, 'Hello World!', $style);?>
streetparade
i just get an error Call to a member function getXfIndex() on a non-object in /home/stre/sqw/inc/pear/Spreadsheet/Excel/Writer/Worksheet.php on line 1234
streetparade
Can't help you with any errors the PEAR package gives. Never worked with it. I'm just pretty sure that the issue is the column width, because I know Excel.
Gordon
its an bug http://pear.php.net/bugs/bug.php?id=2539
streetparade