PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » File Formats » Spreadsheet_Excel_Writer » Bug #4117

Hight of multiline cells is incorrect

Details

Submitted2005-04-11 15:11 UTC
Fromthaberkern at emedia-office dot de
Assignedxnoguer
StatusClosed
PackageSpreadsheet_Excel_Writer
PHP Version5.0.3
OSLinux
Roadmaps(Not assigned)

Comments

[2005-04-11 15:11 UTC] thaberkern at emedia-office dot de

Description:
------------
I use multiline text in a cell. The problem is. The more lines i have in the cell the more pixels are cut of at the bottom line. After about 10 lines in the cell a complete line is missing. This problem occurs only with Excel. If i open the same xls in OpenOffice every thing is fine.

Using version 0.8 of the Excel Writer

Reproduce code:
---------------
$workbook = new Spreadsheet_Excel_Writer();
$workbook->setVersion(8);

// sending HTTP headers
$workbook->send('test.xls');

$format_id =& $workbook->addFormat();
$format_id->setBold();
$format_id->setColor('gray');
$format_id->setPattern(16);
$format_id->setFgColor('silver');
$format_id->setLocked();
$format_id->setAlign("top");
$format_id->setBorder(1);

$format_master =& $workbook->addFormat();
$format_master->setBold();
$format_master->setColor('black');
$format_master->setPattern(4);
$format_master->setFgColor('silver');
$format_master->setLocked();
$format_master->setTextWrap();
$format_master->setAlign("top");
$format_master->setBorder(1);

$format_headline =& $workbook->addFormat();
$format_headline->setBold();
$format_headline->setColor('black');
$format_headline->setPattern(1);
$format_headline->setFgColor('silver');
$format_headline->setLocked();

$format_trans =& $workbook->addFormat();
$format_trans->setColor('blue');
$format_trans->setPattern(4);
$format_trans->setFgColor('yellow');
$format_trans->setUnlocked();
$format_trans->setTextWrap();
$format_trans->setAlign("top");
$format_trans->setBorder(1);

$format_title =& $workbook->addFormat();
$format_title->setBold();
$format_title->setLocked();
$format_title->setSize(14);

$format_note =& $workbook->addFormat();
$format_note->setBold();
$format_note->setLocked();
$format_note->setColor('blue');
$format_note->setPattern(4);
$format_note->setFgColor('yellow');
$format_note->setTextWrap();
$format_note->setAlign('merge');

// Creating a worksheet
$worksheet =& $workbook->addWorksheet('Translation');
$worksheet->protect("xyz");

$worksheet->setColumn(0,0, 300);
$worksheet->setColumn(1,1, 300);
$worksheet->setColumn(2,2, 300);
$worksheet->mergeCells (0, 0, 0, 2);
$worksheet->write(0, 0, "Translation file", $format_title);

//$worksheet->mergeCells (2, 0, 2, 2);
$worksheet->write(2, 0, "Translate all text entries that are written in blue color", $format_note);
$worksheet->write(2, 1, "", $format_note);
$worksheet->write(2, 2, "", $format_note);

$worksheet->write(4, 0, "Dont change in this column", $format_headline);
$worksheet->write(4, 1, $_REQUEST["masterlng"], $format_headline);
$worksheet->write(4, 2, $_REQUEST["translatelng"], $format_headline);

$nLineIndex = 5;
foreach ($arrMasterText as $strId => $strValue)
{
$worksheet->write($nLineIndex, 0, $strId, $format_id);
$worksheet->write($nLineIndex, 1, $strValue[0], $format_master);


$worksheet->write($nLineIndex, 2, $strValue[2], $format_trans);
$nLineIndex++;
}

// Let's send the file
$workbook->close();

[2005-11-07 23:32 UTC] xnoguer at php dot net

this seems to be a problem with Excel, not with the package. setTextWrap() doesn't set the height of a cell.