From 218144cf8924ea12ac86659092075461831abd01 Mon Sep 17 00:00:00 2001 From: mk-j Date: Thu, 2 Feb 2017 13:56:15 -0700 Subject: [PATCH] auto-detect unknown column types (ie missing header def for last column) --- xlsxwriter.class.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/xlsxwriter.class.php b/xlsxwriter.class.php index 118341843..93be5cd60 100644 --- a/xlsxwriter.class.php +++ b/xlsxwriter.class.php @@ -302,15 +302,12 @@ protected function writeCell(XLSXWriter_BuffererWriter &$file, $row_number, $col $file->write(''.self::xmlspecialchars($value).'');//int,float,currency } elseif ($num_format_type=='n_string') { $file->write(''.self::xmlspecialchars($value).''); - } elseif ($num_format_type=='n_auto') { + } elseif ($num_format_type=='n_auto' || 1) { //auto-detect unknown column types if (!is_string($value) || $value=='0' || ($value[0]!='0' && ctype_digit($value)) || preg_match("/^\-?[1-9][0-9]*(\.[0-9]+)?$/", $value)){ $file->write(''.self::xmlspecialchars($value).'');//int,float,currency } else { //implied: ($cell_format=='string') $file->write(''.self::xmlspecialchars($value).''); } - } else { - $file->write(''); - trigger_error("Unknown column type: ".$num_format_type, E_USER_ERROR); } }