Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8464227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:40:47+00:00 2026-06-10T14:40:47+00:00

I am using Cakephp 2.0. I need to generate a Report on daily basics

  • 0

I am using Cakephp 2.0. I need to generate a Report on daily basics in an excel format.
So i written a function to generate a CSV File. Its working fine in Linux machine when i downloads the file in OpenOffice but if I try to open the same file in windows Microsoft then there is no cells, but the data is displaying properly. With this I listed my coding

    $model.= "-".date('d M,Y');
    header ("Expires: Mon, ".date('d M,Y')." GMT");
    header ("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");
    header ("Cache-Control: no-cache, must-revalidate");
    header ("Pragma: no-cache");
    header ("Content-type: application/vnd.ms-excel");
    header ("Content-Disposition: attachment; filename=\"$model.xls" );
    header ("Content-Description: Generated Report" );

Any one helps thanx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:40:49+00:00Added an answer on June 10, 2026 at 2:40 pm

    I think you might doing something wrong here Please check your header. You have mentioned csv in the question and you’re writing excel header. That is might be confusing MS Excel

    header ("Content-type: application/vnd.ms-excel");
    header ("Content-Disposition: attachment; filename=\"$model.xls" );
    header ("Content-Description: Generated Report" );
    

    I’m using this kind of header format which is perfectly working for me in windows and as well as in Open office. Please give a try with this.

    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Content-type: octet/stream");
    header("Content-Type: application/force-download");
    header("Content-Type: application/download");
    header("Content-disposition: attachment; filename=" . basename($filename.".csv"));
    header("refresh: 0; url= ".$redirect_url);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Wa are using CakePHP and need to integrate the Blue Imp file upload libraries.
I'm using CakePHP 2.1 and need to define an Inflector rule for the word
I am doing an e-learning application using CakePHP. The problem is that I need
All, As I am still using CakePHP 1.3 I am in need of using
i am using cakephp 1.3 ...it was working like charm in server ,i copied
I'm using CakePHP for the first time and inside my controller I need to
I am using cakePHP 1.26 and TinyMCE v3.38. The .js file of the TinyMSC
i am using cakephp and i need load Module rewrite , but i can
I have a PHP application using CakePHP. I need to present a table showing
Hi, I need to do the following query using the CakePHP find method: SELECT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.