【发布时间】:2012-04-05 16:09:00
【问题描述】:
我正在使用 PHPExcel 在我的服务器上生成一些工作表。或多或少一切正常,但是,当我尝试为某些行着色(每隔一行,因此列表很容易阅读)时,我得到了有趣的事情:该行颜色正常,但仅在未填充的单元格上数据。填满数据的单元格保持白色。
这是我使用的代码
$ind = ($ind + 1) % 2;
if($ind == 1)
{
$style_header = array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('rgb'=>'CCC'),
),
'font' => array(
'bold' => true,
)
);
$sheet->getStyle($row)->applyFromArray( $style_header );
}
$sheet->getCellByColumnAndRow(0, $row)->setValue($item['qty']);
$sheet->getCellByColumnAndRow(1, $row)->setValueExplicit($item['name']);
$sheet->getCellByColumnAndRow(2, $row)->setValueExplicit($item['size']);
$sheet->getCellByColumnAndRow(3, $row)->setValueExplicit($item['color']);
我做错了什么?
【问题讨论】:
标签: phpexcel