/** * Adiciona uma celula * * @param ZendT_Report_Cell $_cell * @return ZendT_Report_Abstract */ public function addCell(ZendT_Report_Cell $_cell) { $value = $_cell->getValue(); if ($value instanceof ZendT_Type_FileSystem) { /* $pagecount = $this->_driver->setSourceFile($value->getFile()->getFilename()); for ($page = 1; $page <= $pagecount; $page++) { $this->_driver->AddPage(); $tplidx = $this->_driver->importPage($page); $s = $this->_driver->getTemplatesize($tplidx); $this->_driver->useTemplate($tplidx, 0.5, 0.5, $s['w'], $s['h']); } */ $value = utf8_decode($value->get()); } else { if ($value instanceof ZendT_Type) { $value = utf8_decode($value->get()); } else { $value = utf8_decode($value); } } $this->_driver->SetFont($_cell->getFontName(), $_cell->getStyle(), $_cell->getFontSize()); if (strtoupper($value) == $value) { $width = $this->_driver->GetStringWidth('Z'); } else { $width = $this->_driver->GetStringWidth('z'); } if ($_cell->getWidth()) { $space = $_cell->getWidth(); } else { $space = $this->_pageWidth / $this->_maxPerLine; } $numCaracter = round($this->_pxToCm($space) / $width); $arrayValues = array(); $this->_wordWrap($value, $numCaracter, $arrayValues); if (count($arrayValues) > $this->_cells['maxLine']) { $this->_cells['maxLine'] = count($arrayValues); } $this->_cells['values'][] = $arrayValues; $this->_cells['cell'][] = $_cell; return $this; }
/** * Esta função pega uma ZendT_Report_Cell e transforma um array pronto para ser impresso como celula * * @param ZendT_Report_Cell $cell * @return array */ public function makeCell($celula, $options = false) { if (!$celula instanceof ZendT_Report_Cell) { $celula = new ZendT_Report_Cell($celula); } $borders = $celula->getBorders(); $this->SetFont($celula->getFontName(), $celula->getStyle(), $celula->getFontSize()); $corFonteCelula = $this->hex2RGB($celula->getColor()); $this->SetTextColor($corFonteCelula['red'], $corFonteCelula['green'], $corFonteCelula['blue']); if ($borders['borders']) { if (!$borders['color']) { $borders['color'] = '#000000'; } $corBorda = $this->hex2RGB($borders['color']); $this->SetDrawColor($corBorda['red'], $corBorda['green'], $corBorda['blue']); $this->SetLineWidth($borders['width'] . 'px'); } $backgroundColor = $celula->getBackgroundColor(); if ($backgroundColor) { $colorFill = 1; $backgroundColor = $this->hex2RGB($backgroundColor); $this->SetFillColor($backgroundColor['red'], $backgroundColor['green'], $backgroundColor['blue']); } else { if (isset($options['backgroundColor'])) { $backgroundColor = $this->hex2RGB($options['backgroundColor']); $this->SetFillColor($backgroundColor['red'], $backgroundColor['green'], $backgroundColor['blue']); $colorFill = 1; } else { $colorFill = 0; } } return array('celula' => $celula, 'color' => $colorFill, 'border' => $borders['borders']); }