예제 #1
0
 /**
  * Write Pattern Fill
  *
  * @param     \PHPExcel\Shared\XMLWriter            $objWriter         XML Writer
  * @param     \PHPExcel\Style\Fill                    $pFill            Fill style
  * @throws     \PHPExcel\Writer\Exception
  */
 private function writePatternFill(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Style\Fill $pFill = null)
 {
     // fill
     $objWriter->startElement('fill');
     // patternFill
     $objWriter->startElement('patternFill');
     $objWriter->writeAttribute('patternType', $pFill->getFillType());
     if ($pFill->getFillType() !== \PHPExcel\Style\Fill::FILL_NONE) {
         // fgColor
         if ($pFill->getStartColor()->getARGB()) {
             $objWriter->startElement('fgColor');
             $objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
             $objWriter->endElement();
         }
     }
     if ($pFill->getFillType() !== \PHPExcel\Style\Fill::FILL_NONE) {
         // bgColor
         if ($pFill->getEndColor()->getARGB()) {
             $objWriter->startElement('bgColor');
             $objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
             $objWriter->endElement();
         }
     }
     $objWriter->endElement();
     $objWriter->endElement();
 }
예제 #2
0
 /**
  * Create CSS style (\PHPExcel\Style\Fill)
  *
  * @param    \PHPExcel\Style\Fill        $pStyle            \PHPExcel\Style\Fill
  * @return    array
  */
 private function createCSSStyleFill(\PHPExcel\Style\Fill $pStyle)
 {
     // Construct HTML
     $css = array();
     // Create CSS
     $value = $pStyle->getFillType() == \PHPExcel\Style\Fill::FILL_NONE ? 'white' : '#' . $pStyle->getStartColor()->getRGB();
     $css['background-color'] = $value;
     return $css;
 }