public function outputFile($fileName = null, $format = 'Excel2007', $disconnect = true)
    {
        if (!$this->generated) {
            $this->generateFile($fileName, $format, $disconnect);
        }

        if (null === $fileName) {
            $fileName = $this->fileName;
        }

        $handler = fopen($this->filePath, 'r');

        header('Content-Description: File Transfer');
        header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
        header(sprintf('Content-Disposition: attachment; filename=%s', $fileName));
        header('Content-Transfer-Encoding: chunked');
        header('Expires: 0');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
        header(sprintf('Content-Length: %s', filesize($this->filePath)));

        // Send the content in chunks
        while (!feof($handler)) {
            echo fread($handler, 4096);
        }

        return true;
    }
public function outputFile($fileName = null, $format = 'Excel2007', $disconnect = true)
    {
        if (!$this->generated) {
            $this->generateFile($fileName, $format, $disconnect);
        }

        if (null === $fileName) {
            $fileName = $this->fileName;
        }

        $handler = fopen($this->filePath, 'r');

        header('Content-Description: File Transfer');
        header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
        header(sprintf('Content-Disposition: attachment; filename=%s', $fileName));
        header('Content-Transfer-Encoding: chunked');
        header('Expires: 0');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
        header(sprintf('Content-Length: %s', filesize($this->filePath)));

        // Send the content in chunks
        while (!feof($handler)) {
            echo fread($handler, 4096);
        }

        return true;
    }
public function outputFile ( $ fileName = null , $ format = 'Excel2007' , $ disconnect = true ) { if ( ! $ this -> generated ) { $ this -> generateFile ( $ fileName , $ format , $ disconnect ) ; } if ( null === $ fileName ) { $ fileName = $ this -> fileName ; } $ handler = fopen ( $ this -> filePath , 'r' ) ; header ( 'Content-Description: File Transfer' ) ; header ( 'Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ) ; header ( sprintf ( 'Content-Disposition: attachment; filename=%s' , $ fileName ) ) ; header ( 'Content-Transfer-Encoding: chunked' ) ; header ( 'Expires: 0' ) ; header ( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' ) ; header ( 'Pragma: public' ) ; header ( sprintf ( 'Content-Length: %s' , filesize ( $ this -> filePath ) ) ) ; // Send the content in chunks while ( ! feof ( $ handler ) ) { echo fread ( $ handler , 4096 ) ; } return true ; }
Output a file to the browser

@param string $fileName
@param string $format
@param bool $disconnect
@return bool
Output a file to the browser