4,7 → 4,7 |
* |
* PERL Spreadsheet::WriteExcel module. |
* |
* The author of the Spreadsheet::WriteExcel module is John McNamara |
* The author of the Spreadsheet::WriteExcel module is John McNamara |
* <jmcnamara@cpan.org> |
* |
* I _DO_ maintain this code, and John McNamara has nothing to do with the |
31,8 → 31,8 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
*/ |
|
//require_once('PEAR.php'); |
require_once('Writer/Workbook.php'); |
require_once 'PEAR.php'; |
require_once 'Spreadsheet/Excel/Writer/Workbook.php'; |
|
/** |
* Class for writing Excel Spreadsheets. This class should change COMPLETELY. |
65,11 → 65,40 |
function send($filename) |
{ |
header("Content-type: application/vnd.ms-excel"); |
header("Content-Disposition: attachment; filename=$filename"); |
header("Content-Disposition: attachment; filename=\"$filename\""); |
header("Expires: 0"); |
header("Cache-Control: must-revalidate, post-check=0,pre-check=0"); |
header("Pragma: public"); |
} |
|
/** |
* Utility function for writing formulas |
* Converts a cell's coordinates to the A1 format. |
* |
* @access public |
* @static |
* @param integer $row Row for the cell to convert (0-indexed). |
* @param integer $col Column for the cell to convert (0-indexed). |
* @return string The cell identifier in A1 format |
*/ |
function rowcolToCell($row, $col) |
{ |
if ($col > 255) { //maximum column value exceeded |
return new PEAR_Error("Maximum column value exceeded: $col"); |
} |
|
$int = (int)($col / 26); |
$frac = $col % 26; |
$chr1 = ''; |
|
if ($int > 0) { |
$chr1 = chr(ord('A') + $int - 1); |
} |
|
$chr2 = chr(ord('A') + $frac); |
$row++; |
|
return $chr1 . $chr2 . $row; |
} |
} |
?> |