• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

classes/Spreadsheet/Excel/Writer.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003 *  Module written/ported by Xavier Noguer <xnoguer@rezebra.com>
00004 *
00005 *  PERL Spreadsheet::WriteExcel module.
00006 *
00007 *  The author of the Spreadsheet::WriteExcel module is John McNamara 
00008 *  <jmcnamara@cpan.org>
00009 *
00010 *  I _DO_ maintain this code, and John McNamara has nothing to do with the
00011 *  porting of this code to PHP.  Any questions directly related to this
00012 *  class library should be directed to me.
00013 *
00014 *  License Information:
00015 *
00016 *    Spreadsheet_Excel_Writer:  A library for generating Excel Spreadsheets
00017 *    Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com
00018 *
00019 *    This library is free software; you can redistribute it and/or
00020 *    modify it under the terms of the GNU Lesser General Public
00021 *    License as published by the Free Software Foundation; either
00022 *    version 2.1 of the License, or (at your option) any later version.
00023 *
00024 *    This library is distributed in the hope that it will be useful,
00025 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00026 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00027 *    Lesser General Public License for more details.
00028 *
00029 *    You should have received a copy of the GNU Lesser General Public
00030 *    License along with this library; if not, write to the Free Software
00031 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00032 */
00033 
00034 require_once('PEAR.php');
00035 require_once('classes/Spreadsheet/Excel/Writer/Workbook.php');
00036 
00045 class Spreadsheet_Excel_Writer extends Spreadsheet_Excel_Writer_Workbook
00046 {
00053     function Spreadsheet_Excel_Writer($filename = '')
00054     {
00055         $this->_filename = $filename;
00056         $this->Spreadsheet_Excel_Writer_Workbook($filename);
00057     }
00058 
00065     function send($filename)
00066     {
00067         header("Content-type: application/vnd.ms-excel");
00068         header("Content-Disposition: attachment; filename=$filename");
00069         header("Expires: 0");
00070         header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
00071         header("Pragma: public");
00072     }
00073 
00084     function rowcolToCell($row, $col)
00085     {
00086         if ($col > 255) { //maximum column value exceeded
00087             return new PEAR_Error("Maximum column value exceeded: $col");
00088         }
00089         
00090         $int = (int)($col / 26);
00091         $frac = $col % 26;
00092         $chr1 = '';
00093         
00094         if ($int > 0) {
00095             $chr1 = chr(ord('A') + $int - 1);
00096         }
00097         
00098         $chr2 = chr(ord('A') + $frac);
00099         $row++;
00100         
00101         return $chr1.$chr2.$row;
00102     }
00103 }
00104 ?>

Generated on Fri Dec 13 2013 09:06:35 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1