/** * returns Style definition for a specific cell by given identifier * * @param Workbook $oWorkbook * @param Sheet $oSheet * @param int $iColumn * @param int $iRow * * @return Style */ public function getStyleForColumnAndRow(Workbook $oWorkbook, Sheet $oSheet, $iColumn, $iRow) { if (0 == $iRow) { if ($iColumn != 0 && $iColumn != 4) { $this->oHeader->setWidth(5); } else { $this->oHeader->setWidth(20); } return $this->oHeader; } if ($iRow % 2 == 1) { return $this->oStyle; } else { return $this->oStyle2; } }
/** * this method will create standard style information */ private function createStandardStyles() { $this->oStandardStyle = new Style(); $this->oStandardStyle->setFont('Calibri')->setFontSize(12)->setColor('000000'); }
/** * @test */ public function getStandardStyles_defaultStyles_returnStyles() { $oWorkbook = $this->makeWorkbook(); $oStyle = new Style(); $oStyle->setFont('Calibri')->setFontSize(12)->setColor('000000'); $this->assertEquals($oStyle, $oWorkbook->getStandardStyles()); }