_xml; } /** * * @return CreateExcelTable * @static */ public static function getInstance() { if (self::$_instance == NULL) { self::$_instance = new CreateExcelTable(); } return self::$_instance; } /** * Create excel table * * @access public * @param string args[0] * @param string args[1] */ public function createExcelTable() { $this->_xml = ''; $args = func_get_args(); $type = $args[1]; $dats = $args[0]; $tamDatos = count($dats); foreach ($dats as $ind => $data) { $tamCols = count($data); break; } $tamDatos = count($dats); if (strpos($type, 'pie') !== false) { $tamCols = 1; } else { $tamDatos--; } $this->generateTABLE($tamDatos, $tamCols); $this->generateTABLECOLUMNS($tamCols + 1); $this->generateTABLECOLUMN(1, ' '); for ($i = 0; $i < $tamCols; $i++) { if (strpos($type, 'pie') !== false) { $this->generateTABLECOLUMN($i + 2, '0'); break; }else $this->generateTABLECOLUMN($i + 2, $dats[0][$i]); } $this->generateTABLESTYLEINFO(); $this->cleanTemplate(); } /** * Generate table * * @param int $rows * @param int $cols * @access protected */ protected function generateTABLE($rows, $cols) { $chart = 'A'; for ($i = 0; $i < $cols; $i++) $chart++; $rows++; $this->_xml = ''. '