Fix: bug sur le nombre de colonne enregistr

This commit is contained in:
Regis Houssin
2007-09-09 16:30:01 +00:00
parent 6fe53dbb2d
commit 48c7d36518
4 changed files with 22 additions and 23 deletions

View File

@@ -622,7 +622,7 @@ if ($step == 4 && $datatoexport)
// 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',5);
print '</td></tr></table>'; print '</td></tr></table>';
*/ */
} }

View File

@@ -146,26 +146,25 @@ class ExportExcel extends ModeleExports
function write_record($array_alias,$array_selected_sorted,$objp) function write_record($array_alias,$array_selected_sorted,$objp)
{ {
global $langs; global $langs;
$this->col=0; $this->col=0;
foreach($array_selected_sorted as $code => $value) foreach($array_selected_sorted as $code => $value)
{
$alias=$array_alias[$code];
$newvalue=$objp->$alias;
// Nettoyage newvalue
$newvalue=clean_html($newvalue);
// Traduction newvalue
if (eregi('^\((.*)\)$',$newvalue,$reg))
{ {
$alias=$array_alias[$code]; $newvalue=$langs->transnoentities($reg[1]);
$newvalue=$objp->$alias; }
// Nettoyage newvalue $this->worksheet->write($this->row, $this->col, $newvalue);
$newvalue=clean_html($newvalue); $this->col++;
// Traduction newvalue }
if (eregi('^\((.*)\)$',$newvalue,$reg)) $this->row++;
{ return 0;
$newvalue=$langs->transnoentities($reg[1]);
}
$this->worksheet->write($this->row, $this->col, $newvalue);
$this->col++;
}
$this->row++;
return 0;
} }

View File

@@ -1904,9 +1904,9 @@ function set_row() {
$record = 0x0200; // Record identifier $record = 0x0200; // Record identifier
$length = 0x000A; // Number of bytes to follow $length = 0x000A; // Number of bytes to follow
$row_min = $this->_dim_rowmin; // First row $row_min = $this->_dim_rowmin; // First row
$row_max = $this->_dim_rowmax; // Last row plus 1 $row_max = $this->_dim_rowmax + 1; // Last row plus 1
$col_min = $this->_dim_colmin; // First column $col_min = $this->_dim_colmin; // First column
$col_max = $this->_dim_colmax; // Last column plus 1 $col_max = $this->_dim_colmax + 1; // Last column plus 1
$reserved = 0x0000; // Reserved by Excel $reserved = 0x0000; // Reserved by Excel
$header = pack("vv", $record, $length); $header = pack("vv", $record, $length);

View File

@@ -3355,7 +3355,7 @@ function viewExcelFileContent($file_to_include='',$max_rows=0,$max_cols=0)
$data->setOutputEncoding('CPa25a'); $data->setOutputEncoding('CPa25a');
$data->read($file_to_include); $data->read($file_to_include);
error_reporting(E_ALL ^ E_NOTICE); error_reporting(E_ALL ^ E_NOTICE);
echo "<script language='Javascript'> echo "<script language='Javascript'>
var sheet_HTML = Array();\n"; var sheet_HTML = Array();\n";
for($sheet=0;$sheet<count($data->sheets);$sheet++) for($sheet=0;$sheet<count($data->sheets);$sheet++)
@@ -3363,7 +3363,7 @@ function viewExcelFileContent($file_to_include='',$max_rows=0,$max_cols=0)
$table_output[$sheet] .= "<TABLE CLASS='table_body'> $table_output[$sheet] .= "<TABLE CLASS='table_body'>
<TR> <TR>
<TD>&nbsp;</TD>"; <TD>&nbsp;</TD>";
for($i=0;$i<$data->sheets[$sheet]['numCols']&&($i<=$max_cols||$max_cols==0);$i++) for($i=0;$i < $data->sheets[$sheet]['numCols'] && (($i < $max_cols) || ($max_cols == 0));$i++)
{ {
$table_output[$sheet] .= "<TD CLASS='table_sub_heading' ALIGN=CENTER>" . make_alpha_from_numbers($i) . "</TD>"; $table_output[$sheet] .= "<TD CLASS='table_sub_heading' ALIGN=CENTER>" . make_alpha_from_numbers($i) . "</TD>";
} }