diff --git a/xlsxwriter.class.php b/xlsxwriter.class.php index cf38d2555..350acd2f6 100644 --- a/xlsxwriter.class.php +++ b/xlsxwriter.class.php @@ -207,6 +207,18 @@ protected function finalizeSheet($sheet_name) $sheet->finalized=true; } + public function writeCSV(array $data, array $header_types=array() ) + { + $header_text = array_keys($header_types); + + $output = ''; + $output .= implode(';', $header_text) . "\n"; + $output .= implode("\n", array_map(function($array) { + return implode(';', $array); + }, $data)); + return print_r($output); + } + public function writeSheet(array $data, $sheet_name='', array $header_types=array() ) { $sheet_name = empty($sheet_name) ? 'Sheet1' : $sheet_name; @@ -262,7 +274,7 @@ protected function writeStylesXML() $file = new XLSXWriter_BuffererWriter($temporary_filename); $file->write(''."\n"); $file->write(''); - $file->write(''); + $file->write(''); $file->write( ''); $file->write( ''); $file->write( ''); @@ -270,17 +282,17 @@ protected function writeStylesXML() $file->write( ''); $file->write( ''); $file->write(''); - $file->write(''); + $file->write(''); $file->write( ''); $file->write( ''); $file->write( ''); $file->write( ''); $file->write( ''); $file->write(''); - $file->write(''); + $file->write(''); $file->write(' '); $file->write(' '); - $file->write(' '); + $file->write(' '); $file->write(''); $file->write(''); $file->write( ''); @@ -308,7 +320,7 @@ protected function writeStylesXML() $file->write( ''); $file->write( ''); $file->write( ''); - $file->write( ''); + $file->write( ''); $file->write( ''); $file->write( ''); $file->write( '');