Beispiel #1
0
 /**
  * @param array $row
  * @param Style $style
  */
 public function addRow(array $row, Style $style = null)
 {
     if (!empty($row)) {
         $style = $style instanceof Style ? $style : $this->styler->getDefaultStyle();
         $this->styler->addStyle($style);
         $this->sheetFile->fwrite($this->sheet->addRow($row, $style));
     }
 }
Beispiel #2
0
 public function testLock()
 {
     $styler = new Styler();
     $style = new Style();
     $unlockedFont = $style->getFont();
     $unlockedFill = $style->getFill();
     $unlockedBorder = $style->getBorder();
     $styler->addStyle($style);
     $lockedFont = $style->getFont()->setColor('abcdef');
     $this->assertEquals($unlockedFont, $style->getFont());
     $this->assertNotEquals($unlockedFont, $lockedFont);
     $lockedFill = $style->setFillColor('abcdef');
     $this->assertEquals($unlockedFill, $style->getFill());
     $this->assertNotEquals($unlockedFill, $lockedFill);
     $lockedBorder = $style->setSurroundingBorder();
     $this->assertEquals($unlockedBorder, $style->getBorder());
     $this->assertNotEquals($unlockedBorder, $lockedBorder);
 }
Beispiel #3
0
 public function testAddStyle()
 {
     $styler = new Styler();
     $initialXml = $styler->getStyleSheetXml();
     $styler->addStyle(new Style());
     $this->assertEquals($initialXml, $styler->getStyleSheetXml());
     $style = new Style();
     $styler->addStyle($style->setFontBold());
     $oneNewStyleXml = $styler->getStyleSheetXml();
     $this->assertNotEquals($initialXml, $oneNewStyleXml);
     $styler->addStyle($style->setFontBold());
     $this->assertEquals($oneNewStyleXml, $styler->getStyleSheetXml());
 }
Beispiel #4
0
 /**
  * Write style xml file.
  */
 private function finalizeStyles()
 {
     $this->zip->addFromString('xl/styles.xml', $this->styler->getStyleSheetXml());
 }