/** * 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 return $css; }
/** * Create CSS style (PHPExcel_Style_Fill) * * @param PHPExcel_Style_Fill $pStyle PHPExcel_Style_Fill * @return string */ private function _createCSSStyleFill(PHPExcel_Style_Fill $pStyle) { // Construct HTML $html = ''; // Create CSS $html .= ' background-color: ' . '#' . $pStyle->getStartColor()->getRGB() . ';' . "\r\n"; // Return return $html; }
/** * Write Pattern Fill * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Style_Fill $pFill Fill style * @throws 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()); // fgColor $objWriter->startElement('fgColor'); $objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB()); $objWriter->endElement(); // bgColor $objWriter->startElement('bgColor'); $objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB()); $objWriter->endElement(); $objWriter->endElement(); $objWriter->endElement(); }
/** * Write Pattern Fill * * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Style_Fill $pFill Fill style * @throws 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 no fill is selected, there is no need for color information if ($pFill->getFillType() != 'none') { // fgColor $objWriter->startElement('fgColor'); $objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB()); $objWriter->endElement(); // bgColor $objWriter->startElement('bgColor'); $objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB()); $objWriter->endElement(); } $objWriter->endElement(); $objWriter->endElement(); }