• 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

JSON Render Issue in Date Object Laravel and PHP 7.4

With doctrine ODM, can I embed many subdocuments in a main document?

Sync Records With Default Values in Pivot Tables, Call to undefined method syncWithPivotDefaults()

PHP: Print caught exception like Xdebug

How to run or debug php on Visual Studio Code (VSCode)

Hide specific products from unlogged users based in product category in WooCommerce

WooCommerce Additional Information - if empty, hide

How to get the total hour from starting time to end time in php

PHP: How to solve ob_start() in combination imagepng() issue?

Auto increment id JSON

passwordless LDAP login and get user information using Kerberos ticket in PHP

Insert database rows from columns of data from associative array of indexed arrays

Download & Save Zoom Recording in directory by PHP

How to get array values using foreach in laravel

Laravel eloquent update record without loading from database

About Contact Privacy policy Terms and conditions