bug abstract method
Opened this issue · 3 comments
Deleted user commented
I tried to use the library but got error trying to use the example code
Fatal error: Class SimpleExcel\Writer\XMLWriter contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SimpleExcel\Writer\IWriter::saveFile) in D:\htdocs\libraries\SimpleExcel\Writer\XMLWriter.php on line 154
faisalman commented
Ah yes you're right, thanks for spotting that. Since XMLWriter implements IWriter there should be a saveFile() method in XMLWriter.php, like in BaseWriter.php line 80
/**
* Export the document
*
* @param string $filename Name for the saved file (extension will be set automatically)
* @param string $target Save location
* @return void
*/
public function saveFile($filename, $target = NULL){
if (!isset($filename)) {
$filename = date('YmdHis');
}
if (!isset($target)) {
// write output to browser
$target = 'php://output';
}
// set HTTP response header
header('Content-Type: '.$this->content_type);
header('Content-Disposition: attachment; filename='.$filename.'.'.$this->file_extension);
$fp = fopen($target, 'w');
fwrite($fp, $this->getAsString());
fclose($fp);
if ($target == 'php://output') {
// since there must be no data below
exit();
}
}
derbronko commented
I believe, that the function call on line 95 should rename in saveString()...