Custom Colors?

Mar 9, 2011 at 8:09 PM

How do you define and use custom colors using PHPExcel?

Mar 10, 2011 at 12:13 PM
There's a guide in "PHPExcel developer documentation.doc" at 4.6.18.
Formatting cells (page 21).

Also Appendix A (page 45) is especially helpful if you define formatting
with arrays.

On 3/9/2011 4:09 PM, sinerasis wrote:
> How do you define and use custom colors using PHPExcel?
Mar 10, 2011 at 4:40 PM

I understand that, but what about custom palates in Excel? Unfortunately I need more that the 40ish colors that are included in the default palate. Simply setting a cell to a color that isn't in the default scheme doesn't seem to be working for me.

Mar 15, 2011 at 6:17 PM

Bump... maybe I'm not explaining myself well..

I need to use colors that are not in the standard color palate, is this possible with PHPExcel?

The closest thing I'm seeing would be to have a file with the palate I need, then create everything 'by template' or whatever to gain the custom color palate. This just seems a little drastic for such a small change.

Thoughts?

Mar 16, 2011 at 6:01 PM

Loading from template also does not preserve a custom color set, this must not be possible...

Mar 16, 2011 at 6:47 PM

I was able to get what I wanted by manually editing the indexed colors array located in 'PHPExcel/Style/Color.php'. The array for the color set starts on line 371 for those that might be interested.

Not a perfect solution as now ANY spreadsheets generated with my installation will have the custom color set, but that shouldn't be a big deal for my particular setup.

I was not able to find any built in methods to set custom colors with PHPExcel, maybe that would be a good feature request? It would be nice to be able to set the indexed colors on the fly, and shouldn't be terribly difficult to add to the already terrific class. :)