diff --git a/xlsxwriter.class.php b/xlsxwriter.class.php
index 056f04b..2afd112 100644
--- a/xlsxwriter.class.php
+++ b/xlsxwriter.class.php
@@ -1,6 +1,7 @@
$sheet_name);
@@ -224,9 +225,9 @@ protected function writeCell($fd, $row_number, $column_number, $value, $sheet_na
}
if (is_numeric($value)) {
fwrite($fd,''.($value*1).'');//int,float, etc
- } else if ($cell_format=='date') {
+ } else if ($value=='date') {
fwrite($fd,''.intval(self::convert_date_time($value)).'');
- } else if ($cell_format=='datetime') {
+ } else if ($value=='datetime') {
fwrite($fd,''.self::convert_date_time($value).'');
} else if ($value==''){
fwrite($fd,'');
@@ -269,12 +270,12 @@ protected function writeStylesXML()
foreach ($this->defaultStyle as $style) {
if (isset($style['sheet'])) {
if (isset($style['font'])) {
- if (isset($style['font']['name'])) $this->fontName = $style['font']['name'];
- if (isset($style['font']['size'])) $this->fontSize = $style['font']['size'];
- if (isset($style['font']['color'])) $this->fontColor = $style['font']['color'];
- if ($style['font']['bold']) $this->fontStyles .= '';
- if ($style['font']['italic']) $this->fontStyles .= '';
- if ($style['font']['underline']) $this->fontStyles .= '';
+ if (isset($style['font']['name']) && !empty($style['font']['name'])) $this->fontName = $style['font']['name'];
+ if (isset($style['font']['size']) && !empty($style['font']['size'])) $this->fontSize = $style['font']['size'];
+ if (isset($style['font']['color']) && !empty($style['font']['color'])) $this->fontColor = $style['font']['color'];
+ if (isset($style['font']['bold']) && !empty($style['font']['bold'])) $this->fontStyles .= '';
+ if (isset($style['font']['italic']) && !empty($style['font']['italic'])) $this->fontStyles .= '';
+ if (isset($style['font']['underline']) && !empty($style['font']['underline'])) $this->fontStyles .= '';
fwrite($fd, ' ');
if ($this->fontStyles) fwrite($fd, ' '.$this->fontStyles);
@@ -284,8 +285,8 @@ protected function writeStylesXML()
} else {
fwrite($fd, ' ');
}
- fwrite($fd, ' ');
- fwrite($fd, ' ');
+ if ($this->fontName) fwrite($fd, ' ');
+ fwrite($fd, ' ');
if ($this->fontName == 'MS Sans Serif') {
fwrite($fd, ' ');
} else if ($this->fontName == 'Calibri') {
@@ -417,6 +418,7 @@ protected function writeStylesXML()
fwrite($fd, '');
fwrite($fd, '');
fclose($fd);
+
return $tempfile;
}