From 8f2c1b03278e6cf4bda6648dd012a916adc39062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 3 Dec 2023 14:07:56 +0100 Subject: [PATCH] remove MAIN_USE_PHP_WRITEEXCEL --- .../export/export_excel2007.modules.php | 32 +++++-------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index 3c0db565e91..232b5ca1bd4 100644 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -56,6 +56,7 @@ class ExportExcel2007 extends ModeleExports public $version_lib; + /** @var Spreadsheet */ public $workbook; // Handle file public $worksheet; // Handle sheet @@ -182,10 +183,6 @@ class ExportExcel2007 extends ModeleExports // phpcs:enable global $user, $conf, $langs; - if (getDolGlobalString('MAIN_USE_PHP_WRITEEXCEL')) { - $outputlangs->charset_output = 'ISO-8859-1'; // Because Excel 5 format is ISO - } - dol_syslog(get_class($this)."::open_file file=".$file); $this->file = $file; @@ -256,9 +253,7 @@ class ExportExcel2007 extends ModeleExports $selectlabel = array(); $this->col = 1; - if (getDolGlobalString('MAIN_USE_PHP_WRITEEXCEL')) { - $this->col = 0; - } + foreach ($array_selected_sorted as $code => $value) { $alias = $array_export_fields_label[$code]; //print "dd".$alias; @@ -270,24 +265,16 @@ class ExportExcel2007 extends ModeleExports if (preg_match('/^Select:/i', $typefield) && $typefield = substr($typefield, 7)) { $selectlabel[$code."_label"] = $alias."_label"; } - if (getDolGlobalString('MAIN_USE_PHP_WRITEEXCEL')) { - $this->worksheet->write($this->row, $this->col, $outputlangs->transnoentities($alias), $formatheader); - } else { - $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, $outputlangs->transnoentities($alias)); - if (!empty($array_types[$code]) && in_array($array_types[$code], array('Date', 'Numeric', 'TextAuto'))) { // Set autowidth for some types - $this->workbook->getActiveSheet()->getColumnDimension($this->column2Letter($this->col + 1))->setAutoSize(true); - } + $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, $outputlangs->transnoentities($alias)); + if (!empty($array_types[$code]) && in_array($array_types[$code], array('Date', 'Numeric', 'TextAuto'))) { // Set autowidth for some types + $this->workbook->getActiveSheet()->getColumnDimension($this->column2Letter($this->col + 1))->setAutoSize(true); } $this->col++; } foreach ($selectlabel as $key => $value) { - if (getDolGlobalString('MAIN_USE_PHP_WRITEEXCEL')) { - $this->worksheet->write($this->row, $this->col, $outputlangs->transnoentities($value), $formatheader); - } else { - $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, $outputlangs->transnoentities($value)); - if (!empty($array_types[$code]) && in_array($array_types[$code], array('Date', 'Numeric', 'TextAuto'))) { // Set autowidth for some types - $this->workbook->getActiveSheet()->getColumnDimension($this->column2Letter($this->col + 1))->setAutoSize(true); - } + $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, $outputlangs->transnoentities($value)); + if (!empty($array_types[$code]) && in_array($array_types[$code], array('Date', 'Numeric', 'TextAuto'))) { // Set autowidth for some types + $this->workbook->getActiveSheet()->getColumnDimension($this->column2Letter($this->col + 1))->setAutoSize(true); } $this->col++; } @@ -312,9 +299,6 @@ class ExportExcel2007 extends ModeleExports // Define first row $this->col = 1; - if (getDolGlobalString('MAIN_USE_PHP_WRITEEXCEL')) { - $this->col = 0; - } $reg = array(); $selectlabelvalues = array();