Ejemplo n.º 1
0
 /**
  * Add a font to added fonts
  *
  * @param \PHPExcel\Style\Font $font
  * @return int Index to FONT record
  */
 public function addFont(\PHPExcel\Style\Font $font)
 {
     $fontHashCode = $font->getHashCode();
     if (isset($this->addedFonts[$fontHashCode])) {
         $fontIndex = $this->addedFonts[$fontHashCode];
     } else {
         $countFonts = count($this->fontWriters);
         $fontIndex = $countFonts < 4 ? $countFonts : $countFonts + 1;
         $fontWriter = new \PHPExcel\Writer\Excel5\Font($font);
         $fontWriter->setColorIndex($this->addColor($font->getColor()->getRGB()));
         $this->fontWriters[] = $fontWriter;
         $this->addedFonts[$fontHashCode] = $fontIndex;
     }
     return $fontIndex;
 }
Ejemplo n.º 2
0
 /**
  * Get hash code
  *
  * @return string    Hash code
  */
 public function getHashCode()
 {
     return md5($this->getText() . $this->font->getHashCode() . __CLASS__);
 }