/** * Add single row and style to sheet. * * @param array $row * @param Style $style * * @return string */ public function addRow(array $row, Style $style) { $columnCount = count($row); $this->updateMaxColumnCount($columnCount); $this->sizeCalculator->setFont($style->getFont()); $cellXml = $this->getCellXml($row, $style); return $this->getRowXml($style, $columnCount, $cellXml); }
public function testGetCellWidthMultiByte() { $font = new Font(); $font->setName('Segoe UI'); $calculator = new SizeCalculator(new SizeCollection()); $string = 'ä ö32 4eä18 åæçè €äÜuköß ÄöÜÖö üfzp!'; $expectedValues = array(8 => 29, 11 => 39, 12 => 42.5, 13 => 46); foreach ($expectedValues as $fontSize => $minWidth) { $calculator->setFont($font->setSize($fontSize)); $this->assertGreaterThanOrEqual($minWidth, $calculator->getCellWidth($string, $font)); $this->assertLessThanOrEqual($minWidth + 2, $calculator->getCellWidth($string, $font)); } }