1 <?php /* vim: set binary expandtab tabstop=4 shiftwidth=4 textwidth=80:
2 -------------------------------------------------------------------------------
3 Ministerio de EconomÃa
5 -------------------------------------------------------------------------------
6 This file is part of meconlib.
8 meconlib is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2 of the License, or (at your option)
13 meconlib is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License; if not,
18 write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19 Boston, MA 02111-1307 USA
20 -------------------------------------------------------------------------------
21 Creado: Fri Oct 24 16:12:31 2003
22 Autor: Gonzalo Merayo <gmeray@mecon.gov.ar>
23 -------------------------------------------------------------------------------
24 $Id: PDF.php 428 2003-11-18 14:30:30Z mmarre $
25 -----------------------------------------------------------------------------*/
28 * Liberia base para el manejo de xls's.
33 function MECON_XLS($tabla)
38 function _WriteNumber($row,$col,$value)
40 $this->_xls_data .= pack("sssss",0x0203,14,$row,$col,0x00);
41 $this->_xls_data .= pack("d",$value);
44 function _WriteText($row,$col,$value)
46 $len = strlen($value);
47 $this->_xls_data .= pack("s*",0x0204,8+$len,$row,$col,0x00,$len);
48 $this->_xls_data .= $value;
51 function _Write($row,$col,$value)
53 //TODO hacer que guarde segun si es un numero o un texto
54 $this->_WriteText($row,$col,$value);
59 * Funcion que genera el archivo y prepara los headers para que se envie.
66 header("Content-Disposition: filename=planilla.xls");
67 header("Content-Type: application/x-msexcel");
68 $tmp =& $this->toXLS();
69 header('Content-Length: ' . strlen($tmp));
74 * Funcion que devuelve el XLS.
80 $this->_xls_data = pack("ssssss",0x809,0x08,0x00,0x10,0x0,0x0);
81 for($i = 0; $i< $this->_tabla->getRowCount(); $i++)
82 for($j = 0; $j< $this->_tabla->getColCount(); $j++)
83 $this->_Write($i, $j, $this->_tabla->getCellContents($i, $j));
84 $this->_xls_data .= pack("ss",0x0A,0x00);
85 return $this->_xls_data;