Fix: debugage

This commit is contained in:
Regis Houssin 2007-09-08 17:39:18 +00:00
parent ab33f0f45e
commit 221d004e8f
7 changed files with 88 additions and 32 deletions

View File

@ -620,11 +620,11 @@ if ($step == 4 && $datatoexport)
print '</table>'; print '</table>';
// test d'affichage du tableau excel // test d'affichage du tableau excel
/*
print '<table width="100%"><tr><td>'; print '<table width="100%"><tr><td>';
viewExcelFileContent($conf->export->dir_temp.'/1/export_commande_1.xls'); viewExcelFileContent($conf->export->dir_temp.'/1/export_commande_1.xls');
print '</td></tr></table>'; print '</td></tr></table>';
*/
} }

View File

@ -1456,6 +1456,7 @@ function _func()
{ {
$num_args = 0; // number of arguments received $num_args = 0; // number of arguments received
$function = $this->_current_token; $function = $this->_current_token;
$result=0;
$this->_advance(); $this->_advance();
$this->_advance(); // eat the "(" $this->_advance(); // eat the "("
while ($this->_current_token != ')') while ($this->_current_token != ')')

View File

@ -663,7 +663,7 @@ function _store_all_xfs() {
# The default font index is 0 # The default font index is 0
# #
$format = $this->_tmp_format; $format = $this->_tmp_format;
$xf; $xf=NULL;
for ($c=0;$c<15;$c++) { for ($c=0;$c<15;$c++) {
$xf = $format->get_xf('style'); # Style XF $xf = $format->get_xf('style'); # Style XF
@ -1114,7 +1114,7 @@ function _store_palette() {
$record = 0x0092; # Record identifier $record = 0x0092; # Record identifier
$length = 2 + 4 * sizeof($aref); # Number of bytes to follow $length = 2 + 4 * sizeof($aref); # Number of bytes to follow
$ccv = sizeof($aref); # Number of RGB values to follow $ccv = sizeof($aref); # Number of RGB values to follow
//$data; # The RGB data $data=NULL; # The RGB data
# Pack the RGB data # Pack the RGB data
foreach($aref as $dat) { foreach($aref as $dat) {

View File

@ -432,8 +432,16 @@ function set_column() {
return; return;
} }
$width = $_[4] ? 0 : $_[2]; # Set width to zero if column is hidden if (isset($_[4])) {
$format = $_[3]; $width = $_[4];
} else {
$width = 0 ; # Set width to zero if column is hidden
}
if (isset($_[3])) {
$format = $_[3];
} else {
$format = NULL;
}
list($firstcol, $lastcol) = $_; list($firstcol, $lastcol) = $_;
@ -1149,7 +1157,11 @@ function write_number() {
$col = $_[1]; # Zero indexed column $col = $_[1]; # Zero indexed column
$num = $_[2]; $num = $_[2];
//!!! //!!!
$xf = $this->_XF($row, $col, $_[3]); # The cell format if (isset($_[3])) {
$xf = $this->_XF($row, $col, $_[3]); # The cell format
} else {
$xf = $this->_XF($row, $col, NULL); # The cell format
}
# Check that row and col are valid and store max and min values # Check that row and col are valid and store max and min values
if ($row >= $this->_xls_rowmax) { return -2; } if ($row >= $this->_xls_rowmax) { return -2; }
@ -1206,7 +1218,11 @@ function write_string() {
$col = $_[1]; # Zero indexed column $col = $_[1]; # Zero indexed column
$strlen = strlen($_[2]); $strlen = strlen($_[2]);
$str = $_[2]; $str = $_[2];
$xf = $this->_XF($row, $col, $_[3]); # The cell format if (isset($_[3])) {
$xf = $this->_XF($row, $col, $_[3]); # The cell format
} else {
$xf = $this->_XF($row, $col, NULL); # The cell format
}
$str_error = 0; $str_error = 0;
@ -1331,7 +1347,11 @@ function write_formula() {
# we set $num to zero and set the option flags in $grbit to ensure # we set $num to zero and set the option flags in $grbit to ensure
# automatic calculation of the formula when the file is opened. # automatic calculation of the formula when the file is opened.
# #
$xf = $this->_XF($row, $col, $_[3]); # The cell format if (isset($_[3])) {
$xf = $this->_XF($row, $col, $_[3]); # The cell format
} else {
$xf = $this->_XF($row, $col, NULL); # The cell format
}
$num = 0x00; # Current value of formula $num = 0x00; # Current value of formula
$grbit = 0x03; # Option flags $grbit = 0x03; # Option flags
$chn = 0x0000; # Must be zero $chn = 0x0000; # Must be zero
@ -1467,7 +1487,11 @@ function _write_url_web() {
if (isset($_[5])) { if (isset($_[5])) {
$str = $_[5]; # Alternative label $str = $_[5]; # Alternative label
} }
$xf = $_[6] ? $_[6] : $this->_url_format; # The cell format if (isset($_[6])) {
$xf = $_[6] ; # The cell format
} else {
$xf = $this->_url_format; # The cell format
}
# Write the visible label using the write_string() method. # Write the visible label using the write_string() method.
if(!isset($str)) { if(!isset($str)) {
@ -1971,10 +1995,17 @@ function _store_colinfo($_) {
$coldx += 0.72; # Fudge. Excel subtracts 0.72 !? $coldx += 0.72; # Fudge. Excel subtracts 0.72 !?
$coldx *= 256; # Convert to units of 1/256 of a char $coldx *= 256; # Convert to units of 1/256 of a char
//$ixfe; # XF index $ixfe=NULL; # XF index
$grbit = $_[4] || 0; # Option flags $grbit = 0;
if (isset($_[4])) {
$grbit = $_[4] ; # Option flags
}
$reserved = 0x00; # Reserved $reserved = 0x00; # Reserved
$format = $_[3]; # Format object
$format = 0x0F;
if (isset($_[3])) {
$format = $_[3]; # Format object
}
# Check for a format object # Check for a format object
if (isset($_[3])) { if (isset($_[3])) {
@ -2008,8 +2039,15 @@ function _store_selection($_) {
$rwFirst = $_[0]; # First row in reference $rwFirst = $_[0]; # First row in reference
$colFirst = $_[1]; # First col in reference $colFirst = $_[1]; # First col in reference
$rwLast = $_[2] ? $_[2] : $rwFirst; # Last row in reference $rwLast = $rwFirst; # Last row in reference
$colLast = $_[3] ? $_[3] : $colFirst; # Last col in reference if (isset($_[2])) {
$rwLast = $_[2]; # Last row in reference
}
$colLast = $colFirst; # Last col in reference
if (isset($_[3])) {
$colLast = $_[3] ; # Last col in reference
}
# Swap last row/col for first row/col as necessary # Swap last row/col for first row/col as necessary
if ($rwFirst > $rwLast) { if ($rwFirst > $rwLast) {
@ -2595,8 +2633,14 @@ function insert_bitmap() {
$bitmap = $_[2]; $bitmap = $_[2];
$x = $_[3] ? $_[3] : 0; $x = $_[3] ? $_[3] : 0;
$y = $_[4] ? $_[4] : 0; $y = $_[4] ? $_[4] : 0;
$scale_x = $_[5] ? $_[5] : 1; $scale_x = 1;
$scale_y = $_[6] ? $_[6] : 1; $scale_y = 1;
if (isset($_[5])) {
$scale_x = $_[5] ;
}
if (isset($_[6])) {
$scale_y = $_[6] ;
}
list($width, $height, $size, $data) = $this->_process_bitmap($bitmap); list($width, $height, $size, $data) = $this->_process_bitmap($bitmap);

View File

@ -13,10 +13,11 @@ require_once "class.writeexcel_workbook.inc.php";
require_once "class.writeexcel_worksheet.inc.php"; require_once "class.writeexcel_worksheet.inc.php";
$fname = tempnam("/tmp", "colors.xls"); $fname = tempnam("/tmp", "colors.xls");
$workbook = &new writeexcel_workbook($fname); $workbook = new writeexcel_workbook($fname);
# Some common formats # Some common formats
$center =& $workbook->addformat(array('align' => 'center')); $center =& $workbook->addformat(array('align' => 'center'));
$heading =& $workbook->addformat(array('align' => 'center', 'bold' => 1)); $heading =& $workbook->addformat(array('align' => 'center', 'bold' => 1));
# Try this to see the default Excel 5 palette # Try this to see the default Excel 5 palette
@ -47,6 +48,7 @@ $colors = array(
$worksheet1 =& $workbook->addworksheet('Named colors'); $worksheet1 =& $workbook->addworksheet('Named colors');
$worksheet1->set_column(0, 3, 15); $worksheet1->set_column(0, 3, 15);
$worksheet1->write(0, 0, "Index", $heading); $worksheet1->write(0, 0, "Index", $heading);
@ -71,6 +73,10 @@ foreach ($colors as $color=>$index) {
} }
###################################################################### ######################################################################
# #
# Demonstrate the standard Excel colors in the range 8..63. # Demonstrate the standard Excel colors in the range 8..63.
@ -104,6 +110,7 @@ for ($i=8;$i<=63;$i++) {
} }
} }
$workbook->close(); $workbook->close();
header("Content-Type: application/x-msexcel; name=\"example-colors.xls\""); header("Content-Type: application/x-msexcel; name=\"example-colors.xls\"");

View File

@ -17,10 +17,10 @@ $worksheet3 =& $workbook->addworksheet('And another');
# #
$worksheet->set_column('A:B', 32); $worksheet->set_column('A:B', 32);
$heading =& $workbook->addformat(array( $heading =& $workbook->addformat(array(
bold => 1, 'bold' => 1,
color => 'blue', 'color' => 'blue',
size => 18, 'size' => 18,
merge => 1, 'merge' => 1,
)); ));
$headings = array('Features of php_writeexcel', ''); $headings = array('Features of php_writeexcel', '');
@ -31,11 +31,11 @@ $worksheet->write_row('A1', $headings, $heading);
# Some text examples # Some text examples
# #
$text_format =& $workbook->addformat(array( $text_format =& $workbook->addformat(array(
bold => 1, 'bold' => 1,
italic => 1, 'italic' => 1,
color => 'red', 'color' => 'red',
size => 18, 'size' => 18,
font => 'Comic Sans MS' 'font' => 'Comic Sans MS'
)); ));
$worksheet->write('A2', "Text"); $worksheet->write('A2', "Text");
@ -47,8 +47,8 @@ $worksheet->write('B3', "Hello Excel", $text_format);
# #
# Some numeric examples # Some numeric examples
# #
$num1_format =& $workbook->addformat(array(num_format => '$#,##0.00')); $num1_format =& $workbook->addformat(array('num_format' => '$#,##0.00'));
$num2_format =& $workbook->addformat(array(num_format => ' d mmmm yyy')); $num2_format =& $workbook->addformat(array('num_format' => ' d mmmm yyy'));
$worksheet->write('A4', "Numbers"); $worksheet->write('A4', "Numbers");
$worksheet->write('B4', 1234.56); $worksheet->write('B4', 1234.56);

View File

@ -725,22 +725,24 @@ class Spreadsheet_Excel_Reader
$spos += $length + 4; $spos += $length + 4;
//var_dump($this->formatRecords); //var_dump($this->formatRecords);
//echo "code $code $length"; //echo "code $code $length";
//echo 'code dimension '.base_convert(SPREADSHEET_EXCEL_READER_TYPE_DIMENSION,10,16).'<br>';
while($cont) { while($cont) {
//echo "mem= ".memory_get_usage()."\n"; //echo "mem= ".memory_get_usage()."\n";
// $r = &$this->file->nextRecord(); // $r = &$this->file->nextRecord();
$lowcode = ord($this->data[$spos]); $lowcode = ord($this->data[$spos]);
//echo 'lowcode '.$lowcode.'<br>';
if ($lowcode == SPREADSHEET_EXCEL_READER_TYPE_EOF) break; if ($lowcode == SPREADSHEET_EXCEL_READER_TYPE_EOF) break;
$code = $lowcode | ord($this->data[$spos+1])<<8; $code = $lowcode | ord($this->data[$spos+1])<<8;
$length = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8; $length = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8;
$spos += 4; $spos += 4;
$this->sheets[$this->sn]['maxrow'] = $this->_rowoffset - 1; $this->sheets[$this->sn]['maxrow'] = $this->_rowoffset - 1;
$this->sheets[$this->sn]['maxcol'] = $this->_coloffset - 1; $this->sheets[$this->sn]['maxcol'] = $this->_coloffset - 1;
//echo "Code=".base_convert($code,10,16)." $code\n"; //echo "Code=".base_convert($code,10,16)." - base16=".$code."<br>";
unset($this->rectype); unset($this->rectype);
$this->multiplier = 1; // need for format with % $this->multiplier = 1; // need for format with %
switch ($code) { switch ($code) {
case SPREADSHEET_EXCEL_READER_TYPE_DIMENSION: case SPREADSHEET_EXCEL_READER_TYPE_DIMENSION:
//echo 'Type_DIMENSION '; //echo 'Type_DIMENSION <br>';
if (!isset($this->numRows)) { if (!isset($this->numRows)) {
if (($length == 10) || ($version == SPREADSHEET_EXCEL_READER_BIFF7)){ if (($length == 10) || ($version == SPREADSHEET_EXCEL_READER_BIFF7)){
$this->sheets[$this->sn]['numRows'] = ord($this->data[$spos+2]) | ord($this->data[$spos+3]) << 8; $this->sheets[$this->sn]['numRows'] = ord($this->data[$spos+2]) | ord($this->data[$spos+3]) << 8;
@ -751,6 +753,8 @@ class Spreadsheet_Excel_Reader
} }
} }
//echo 'numRows '.$this->numRows.' '.$this->numCols."\n"; //echo 'numRows '.$this->numRows.' '.$this->numCols."\n";
//echo 'numRows '.$this->sheets[$this->sn]['numRows'].'<br>';
//echo 'numRows '.$this->sheets[$this->sn]['numCols'].'<br>';
break; break;
case SPREADSHEET_EXCEL_READER_TYPE_MERGEDCELLS: case SPREADSHEET_EXCEL_READER_TYPE_MERGEDCELLS:
$cellRanges = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8; $cellRanges = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8;