Exemple #1
0
 /**
  * @return Font[]
  */
 protected function getFonts()
 {
     $fontsMap = array();
     $defaultFont = $this->tmpFormat->getFont();
     $defaultFont->setIndex(0);
     $key = $defaultFont->getKey();
     $fontsMap[$key] = 1;
     //add default font for 5 times
     $fonts = array_fill(0, 5, $defaultFont);
     // Iterate through the XF objects and write a FONT record if it isn't the
     // same as the default FONT and if it hasn't already been used.
     $index = 6;
     // The first user defined FONT
     foreach ($this->formats as $format) {
         $font = $format->getFont();
         $key = $font->getKey();
         if (!isset($fontsMap[$key])) {
             // Add a new FONT record
             $fontsMap[$key] = 1;
             $font->setIndex($index);
             $fonts[] = $font;
             $index++;
         }
     }
     return $fonts;
 }
Exemple #2
0
 /**
  * @param XlsFormat $format
  *
  * @return array
  */
 protected function getFlags($format)
 {
     return array('Num' => $format->getNumFormat() != NumberFormat::TYPE_GENERAL ? 1 : 0, 'Fnt' => $format->getFont()->getIndex() != 0 ? 1 : 0, 'Alc' => $format->textWrap ? 1 : 0, 'Bdr' => $format->getBorderStyle('top') || $format->getBorderStyle('right') || $format->getBorderStyle('bottom') || $format->getBorderStyle('left') ? 1 : 0, 'Pat' => $format->fgColor != 0x40 || $format->bgColor != 0x41 || $format->pattern ? 1 : 0, 'Prot' => $format->locked | $format->hidden);
 }