gradients show as solid color

Apr 1, 2009 at 7:59 PM
This code:
 

$objPHPExcel->getActiveSheet()->getStyle('A3')->applyFromArray(
        array(
            'font'    => array(
                'bold'      => true
            ),
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
            ),
            'borders' => array(
                'top'     => array(
                     'style' => PHPExcel_Style_Border::BORDER_THIN
                 )
            ),
            'fill' => array(
                 'type'       => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR,
                  'rotation'   => 90,
                 'startcolor' => array(
                     'argb' => 'FFA0A0A0'
                 ),
                 'endcolor'   => array(
                     'argb' => 'FFFFFFFF'
                 )
             )
        ),
        'A3:E3'
);


makes cell A3 a gray color and that is it. No gradient. I've been trying this for awhile now, tried many methods but I can't get anything to be a gradient.
Developer
Apr 2, 2009 at 5:57 AM
It is working for me with Excel2007 writer, but with Excel5 writer one just gets solid fill. As far as I know older versions of MS Office Excel do not support gradient fill.

Apr 2, 2009 at 12:23 PM
Hmm yeah I'm writing to Excel2007. I have a gradient in a manually created excel done in 2003. I am trying to open the file that I generate both in 2003 and on OpenOffice 3.0 and neither show a gradient. :/
Developer
Apr 2, 2009 at 4:39 PM
You will not be able to see gradient fill in MS Office Excel 2003. It won't help with the "Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats". This component does not allow you to use Excel 2007 features in MS Office Excel 2003.

MS Office Excel 2003 + compatibility pack is not a replacement for MS Office Excel 2007. You are still subject to limitations of the application such as maximum 256 columns etc. All it gives you is a file converter that tries to do its best, it does not really extend the capabilities of the application.

Apr 2, 2009 at 6:12 PM
I have a 2003 document, made in Excel 2003 and opens in 2003 without any conversion that has a gradient.
Developer
Apr 3, 2009 at 7:56 AM
This indicates that my previous post has wrong information. Can you please send me the file you created (erik at phpexcel dot net) ?

Developer
Apr 3, 2009 at 3:02 PM
Thanks, I received the Excel file. Indeed the gradient is actually created using a gradient fill in a shape which is possible in Excel 2003. It is not a cell background gradient fill as is possible in Excel 2007.

PHPExcel does not support shapes such except for images, unfortunately. Your best option may be to use a image although it takes up more space in the document.

Apr 3, 2009 at 4:55 PM
I wouldn't have a problem using an image, and I was at first. Though, it was blurring my image and not keeping it clear as it should have. Any ideas on why that would be?
Developer
Apr 3, 2009 at 6:18 PM
Not sure what kind of image you used, but it is best to use PNG.

JPEG would not be suitable for a gradient image, and GIF should be avoided with Excel5 writer as it requires extra manipulation within the classes.