[ask]export xlsx with phpexcel

hi all, i want to ask how to export excel but i want it extension is .xlxs not xls?

i edit the code in phpexcel extension php-excel.class.php


   public function generateXML ($filename = 'excel-export', $correctFilename=true)

        {

                // correct/validate filename

                if($correctFilename)

                    $filename = preg_replace('/[^aA-zZ0-9\_\-]/', '', $filename);

    	

                // deliver header (as recommended in php manual)

                header("Content-Type: application/vnd.ms-excel; charset=" . $this->sEncoding);

               [u] header("Content-Disposition: inline; filename=\"" . $filename . ".xls\"");

[/u]

                // print out document to the browser

                // need to use stripslashes for the damn ">"

                echo stripslashes (sprintf($this->header, $this->sEncoding));

                echo "\n<Worksheet ss:Name=\"" . $this->sWorksheetTitle . "\">\n<Table>\n";

                foreach ($this->lines as $line)

                        echo $line;


                echo "</Table>\n</Worksheet>\n";

                echo $this->footer;

        }



i change the this code


  header("Content-Disposition: inline; filename=\"" . $filename . "[u].xls[/u]\"");

into this code:


  header("Content-Disposition: inline; filename=\"" . $filename . "[u].xlsx[/u]\"");

its working not show any error, but when i download or open the file the extension is .xlsx.xls

thanks

I think that your filename already contain extension, so with




 header("Content-Disposition: inline; filename=\"" . $filename . ".xlsx\"");



uou just add extension to exstion one.

try:




 header("Content-Disposition: inline; filename=\"" . $filename );



and tell me if this will fix your problem.

it still open or save in .xls

i change the header code to xml excel 2007 like this :


header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=" .$this->sEncoding);

      header("Content-Disposition: attachment;filename=\"" . $filename .".xlsx\"");

the extension change into xlsx now, but i can open the file, the error said is invalid extension, can someone help me?

hi am using the phpexcel extension… when ever i generate report it’s automatically download but i want only view in browser… if u have any suggestion please reply me to vigsacet@gmail.com