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 #2346

SetColumn - Format not set

Details

Submitted2004-09-16 01:57 UTC
Fromderrickbtan dot lists at gmail dot com
StatusNo Feedback
PackageSpreadsheet_Excel_Writer
PHP Version5.0.1
OSWindows 2000
Roadmaps(Not assigned)

Comments

[2004-09-16 01:57 UTC] derrickbtan dot lists at gmail dot com

Description:
------------
Spreadsheet_Excel_Writer 0.8
OLE 0.5

The sample code provided is a just a little bit of the data I want to write, but it should be enough to reproduce the problem. I have tried putting the setcolumns and format call before the data is written as well (the sample code tries formatting after).

Reproduce code:
---------------
$empName = $emp->getEmployeeName();
$reportDate = date( "Y/m/d", $rep->getReportDate() );
$ws = $this->xls->addWorkSheet( "$empName - $reportDate" );

// Write the data
$col = 0;
$row = 0;
// Print the date (A1)
$ws->write( $row, $col++, $this->configArray['l_date'] );
$ws->write( $row++, $col--, $reportDate );
// Print the division (A2)
$ws->write( $row, $col++, $this->configArray['l_division'] );
$ws->write( $row++, $col--, $div->getName() );
///////////////
// . . .
//////////////
// Data format
$this->format['data'] = $this->xls->addFormat( array( 'size' => 10, 'align' => 'right' ) );
//////////////
// Set column
$ws->setColumn( 0, 2, 20, $this->format['data'] );

Expected result:
----------------
In the example provided, I would expect all alignment to be down the right side of the columns 0-2 with the column width set to 20.

Actual result:
--------------
The width is ok, but the format does not occur.

[2004-09-16 02:04 UTC] derrickbtan dot lists at gmail dot com

different email.

[2005-06-28 05:05 UTC] g at funk dot com

the version is 5.0.1, meaning that the object model shouldn't require the &.

[2005-08-23 14:24 UTC] daniel dot chafen at virgin dot no dot spam

Seting the format works but it is reset if any data is added using the write or writeFormula even when no format attribute is used. It is very frustrating to have to keep adding the format with every write command.

[2005-11-08 13:33 UTC] xnoguer at php dot net

sample code can't work, so I'm putting this in feedback status until provided a proper sample code.