SimpleExcel\SimpleExcel::constructWriter PHP Method

constructWriter() public method

Construct a SimpleExcel Writer
public constructWriter ( string $filetype ) : boolean
$filetype string Set the filetype of the file which will be written (XML/CSV/TSV/HTML/JSON)
return boolean
    public function constructWriter($filetype)
    {
        $filetype = strtoupper($filetype);
        if (!in_array($filetype, $this->validWriterTypes)) {
            throw new \Exception('Filetype ' . $filetype . ' is not supported', SimpleExcelException::FILETYPE_NOT_SUPPORTED);
        }
        $writer_class = 'SimpleExcel\\Writer\\' . $filetype . 'Writer';
        $this->writer = new $writer_class();
    }