Incorrect Fills

Topics: User Forum
Jan 22, 2008 at 9:22 PM
Edited Jan 22, 2008 at 9:23 PM
In writing an Excel5 file, I'm finding out that using this constant: FILL_PATTERN_LIGHTGRID
produces a fill defined as: white thin-horz-cross when I save the file as HTML.

And one that uses this constant: FILL_PATTERN_LIGHTGRAY
produces a fill defined as: white thin-diag-stripe when I save the file as HTML.

And using one with the constant: FILL_PATTERN_GRAY125
produces a fill defined as: white thin-vert-stripe when I save as HTML.

Now, aren't those incorrect?

Also, why is there a background color being set at all if I just set the fill type? Shouldn't it be set to Automatic
if I do not explicitly set a background color for the cell that contains the pattern?
Coordinator
Jan 23, 2008 at 6:58 AM
When saving as HTML, not all constants are fully equivalent to their (eventual) HTML markup.

Do you have any suggestions for better conversion values in this case?
Jan 24, 2008 at 2:52 PM
Edited Jan 24, 2008 at 3:27 PM

maartenba wrote:
When saving as HTML, not all constants are fully equivalent to their (eventual) HTML markup.

Do you have any suggestions for better conversion values in this case?


http://www.crnorthampton.com/new_site/downloadpcrpt.php?pcmonth=04&pcyear=2008&pcday=21

It doesn't matter if it is saved to HTML or not, the values placed in the file are incorrect because it shows incorrectly, even in Excel.
I only saved in HTML so I could see the actual values being used in the file.

If I open the Format->Cells->Pattern dialog the values do not correspond to the settings that I created the file with.
Here's a screenshot: (Excel5 format file opened in Excel2003, opened with cell A9 selected)
http://www.crnorthampton.com/new_site/PHPExcel_Fills.png

I'm doing this to alternate the row fill:

$fill= $i % 2 ? PHPExcelStyleFill::FILLPATTERNGRAY125 : PHPExcelStyleFill::FILL_NONE;

and later, using it:

$objPHPExcel->getActiveSheet()->getStyle("A".$row)->getFill()->setFillType($fill);
$objPHPExcel->getActiveSheet()->getStyle("B".$row)->getFill()->setFillType($fill);
$objPHPExcel->getActiveSheet()->getStyle("C".$row)->getFill()->setFillType($fill);
$objPHPExcel->getActiveSheet()->getStyle("D".$row)->getFill()->setFillType($fill);
$objPHPExcel->getActiveSheet()->getStyle("E".$row)->getFill()->setFillType($fill);

Also, why would a background color be being assigned for the Pattern? Should be set to Automatic. (When you
dropdown the Patterns combo, see the color selection)

Here is the Biff5 chart for patterns
http://www.crnorthampton.com/new_site/Biff5_2.5.12.png

The one I want is value 12h
Jan 24, 2008 at 4:33 PM
Edited Jan 24, 2008 at 4:33 PM

MrBaseball34 wrote:
<SNIP>
Also, why would a background color be being assigned for the Pattern? Should be set to Automatic. (When you
dropdown the Patterns combo, see the color selection)

Here is the Biff5 chart for patterns
http://www.crnorthampton.com/new_site/Biff5_2.5.12.png

The one I want is value 12h


Ok, I've had a change of heart and done this instead:

$fill = $i % 2 ? PHPExcelStyleFill::FILLSOLID : PHPExcelStyleFill::FILLNONE;
$color = $i % 2 ? '00E0E0E0' : 'FFFFFFFF';

$objPHPExcel->getActiveSheet()->getStyle("A".$row)->getFill()->setFillType($fill);
$objPHPExcel->getActiveSheet()->getStyle("A".$row)->getFill()->getStartColor()->setARGB($color);
$objPHPExcel->getActiveSheet()->getStyle("B".$row)->getFill()->setFillType($fill);
$objPHPExcel->getActiveSheet()->getStyle("B".$row)->getFill()->getStartColor()->setARGB($color);
$objPHPExcel->getActiveSheet()->getStyle("C".$row)->getFill()->setFillType($fill);
$objPHPExcel->getActiveSheet()->getStyle("C".$row)->getFill()->getStartColor()->setARGB($color);
$objPHPExcel->getActiveSheet()->getStyle("D".$row)->getFill()->setFillType($fill);
$objPHPExcel->getActiveSheet()->getStyle("D".$row)->getFill()->getStartColor()->setARGB($color);
$objPHPExcel->getActiveSheet()->getStyle("E".$row)->getFill()->setFillType($fill);
$objPHPExcel->getActiveSheet()->getStyle("E".$row)->getFill()->getStartColor()->setARGB($color);