Php Excel Reader - 获取背景颜色

Php Excel Reader  - 获取背景颜色

问题描述:

I am using phpexcelreader:

http://sourceforge.net/projects/phpexcelreader/

And It is working nicely compared to all the others I tried, But I am struggling to find a way to get background colors of the cells, or any color formatting to be honest.

Does anyone know of how to do this with this class, or, how to add it into this class?

It can't be too hard, surely?

我正在使用phpexcelreader: p>

http://sourceforge.net/projects/phpexcelreader/ p>

与它相比,它工作得很好 我试过的所有其他人,但我很难找到一种方法来获得细胞的背景颜色,或者说任何颜色格式都是诚实的。 p>

有没有人知道怎么做这个 这个类,或者,如何将它添加到这个类中? p>

它肯定不是太难了? p> div>

Assuming that $data is the phpExcelReader object you can use:

$data->bgColor($row,$col,$sheet=0);

which is returned in #FFFFFF format.

I think you can find some good docs here: http://code.google.com/p/php-excel-reader/wiki/Documentation

From user comments, the updated syntax is:

$bgcolor = $xls->colors[$xls->bgColor($y,$x,$sheet)];

which is not covered in the docs.

Fluffeh, has got a good point. I assume the problem is in the version of php-excel-reader you downloaded, it is sure out of date or it is prior the version 2.2.

enter image description here

So go to https://code.google.com/p/php-excel-reader/downloads/list and download the latest version to get that function in production. :)

Also in the version 2.21 it looks like this:

ver 2.21 of excel_reader2.php

Also in the version 2.2 it looks like this:

ver 2.2 of excel_reader2.php

I hope it will help also somebody :). Happy programming.