Re: Trouble formatting excel spreadsheet
| From: | Torsten Roehr | Date: | Wed, 19 Jan 2005 14:11:23 +0000 |
| Subject: | Re: Trouble formatting excel spreadsheet | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17017@lists.php.net to get a copy of this message | ||
"Louis Young" <louis@kwikpay.co.za> wrote in message
news:41EE5CBE.4060304@kwikpay.co.za...
> Hi there
>
> I'm trying to format an excel spreadsheet using Apache 2, PHP 5 and PEAR
> on Windows XP.
>
> Here's the code:
>
> $workbook=new Spreadsheet_Excel_Writer("test.xls");
>
> // Add a new worksheet
> $worksheet=& $workbook->addWorksheet("Electricity Transactions");
>
> // add the color format to the workbook
> $format_color=& $workbook->addFormat();
> $format_color->setBgColor('green');
> $format_color->setPattern(0);
> $ReturnBalance=2;
> $worksheet->write(2, 1, "Current Balance : R
> ".number_format($ReturnBalance, 2), $format_color);
>
> $workbook->close();
>
>
> But when I open the spreadsheet the background of the cell is white.
> What gives?
>
> Cheers
> Louis
Hi Louis,
please take a look at these doc pages:
http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.s
preadsheet-excel-writer-format.setfgcolor.php
http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.s
preadsheet-excel-writer-format.setbgcolor.php
http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.s
preadsheet-excel-writer-format.setcolor.php
Especially the "Description" paragraphs.
HTH, Torsten