Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A problem when export xlsx format #32

Closed
seongmo opened this issue Feb 21, 2014 · 0 comments
Closed

A problem when export xlsx format #32

seongmo opened this issue Feb 21, 2014 · 0 comments

Comments

@seongmo
Copy link

seongmo commented Feb 21, 2014

I'm sorry for my bad english.

When I use export method with xlsx format, it downloaded xls extension.

So, I fix setHeaders method like this.

private function setHeaders()
    {
        // Set the headers
        switch($this->ext)
        {
            case 'xlsx':
                header('Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
                break;

            case 'csv':
                header('Content-type: application/csv');
                break;

            default: // xls
                header('Content-Type: application/vnd.ms-excel');
                break;
        }


        header('Content-Disposition: attachment;filename="' . $this->title . '.'. $this->ext .'"');
        header('Cache-Control: max-age=0');
        header('Cache-Control: max-age=1');
        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
        header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
        header('Pragma: public'); // HTTP/1.0
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants