Example #1
0
 /**
  * Create a new Style
  *
  * @param boolean $isSupervisor
  */
 public function __construct($isSupervisor = false)
 {
     // Supervisor?
     $this->_isSupervisor = $isSupervisor;
     // Initialise values
     $this->_conditionalStyles = array();
     $this->_font = new Style_Font($isSupervisor);
     $this->_fill = new Style_Fill($isSupervisor);
     $this->_borders = new Style_Borders($isSupervisor);
     $this->_alignment = new Style_Alignment($isSupervisor);
     $this->_numberFormat = new Style_NumberFormat($isSupervisor);
     $this->_protection = new Style_Protection($isSupervisor);
     // bind parent if we are a supervisor
     if ($isSupervisor) {
         $this->_font->bindParent($this);
         $this->_fill->bindParent($this);
         $this->_borders->bindParent($this);
         $this->_alignment->bindParent($this);
         $this->_numberFormat->bindParent($this);
         $this->_protection->bindParent($this);
     }
 }
Example #2
0
 /**
  * Get an array of all fills
  *
  * @param 	PHPExcel						$pPHPExcel
  * @return 	Style_Fill[]		All fills in PHPExcel
  * @throws 	Exception
  */
 public function allFills(PHPExcel $pPHPExcel = null)
 {
     // Get an array of unique fills
     $aFills = array();
     // Two first fills are predefined
     $fill0 = new Style_Fill();
     $fill0->setFillType(Style_Fill::FILL_NONE);
     $aFills[] = $fill0;
     $fill1 = new Style_Fill();
     $fill1->setFillType(Style_Fill::FILL_PATTERN_GRAY125);
     $aFills[] = $fill1;
     // The remaining fills
     $aStyles = $this->allStyles($pPHPExcel);
     foreach ($aStyles as $style) {
         if (!array_key_exists($style->getFill()->getHashCode(), $aFills)) {
             $aFills[$style->getFill()->getHashCode()] = $style->getFill();
         }
     }
     return $aFills;
 }
Example #3
0
 /**
  * Create CSS style (Style_Fill)
  *
  * @param	Style_Fill		$pStyle			Style_Fill
  * @return	array
  */
 private function _createCSSStyleFill(Style_Fill $pStyle)
 {
     // Construct HTML
     $css = array();
     // Create CSS
     $value = $pStyle->getFillType() == Style_Fill::FILL_NONE ? 'white' : '#' . $pStyle->getStartColor()->getRGB();
     $css['background-color'] = $value;
     // Return
     return $css;
 }