• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

PHPExcel_IOFactory::createWriter causes wrong behaviour

phpphpexcel


PHP Snippet 1:

07:31:12 Create new PHPExcel object 
07:31:12 Set properties 
07:31:12 Add some data 
07:31:12 Rename sheet 
07:31:12 Write to Excel2007 format 

PHP Snippet 2:

    $objWriter =  PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');

    header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
    header('Content-Disposition: attachment;filename="workbook1.xlsx"');
    header('Cache-Control: max-age=0');

    ob_end_clean();
    $objWriter->save('php://output');
    exit;

Related Snippets

Artisan, creating tables in database

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given [duplicate]

Laravel MSSQL Server Connection not working

PHP header location absolute URL

Check if my GET request has Header: Token

PHP array_filter with arguments

Only on Firefox "Loading failed for the <script> with source"

phpseclib 2.0 can not use Composer to create autoload

No definition found for function in vendor vscode

Applying programmatically a coupon to an Order in WooCommerce3

How to convert a carbon into string, to take the date only?

Currently Using CodeIgniter Framework i have an Error

Facebook PHP SDK - will not logout properly

Why does array_map() with null as callback create an "array of arrays"?

Codeigniter, Severity: error --> Exception: Too few arguments to function, admin dashboard shows HTTP error 500

About Contact Privacy policy Terms and conditions