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

  • SEARCH
  • Home
  • 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 4551640
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:39:52+00:00 2026-05-21T16:39:52+00:00

I am printing excel like this: header(Content-Type: application/vnd.ms-excel; charset=utf-8); header(Content-type: application/x-msexcel; charset=utf-8); header(Content-Disposition: attachment;

  • 0

I am printing excel like this:

header("Content-Type:   application/vnd.ms-excel; charset=utf-8");
header("Content-type:   application/x-msexcel; charset=utf-8");
header("Content-Disposition: attachment; filename=".str_replace(' ', '_', $title).".xls"); 
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); 

The content is plain html. The problem, when I download this, I get an initial confirmation box written

The file you are trying to open 'File_name.xls', is in a different format than specified by the file extension. Verified that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?

When I do ‘yes’, I get this. Bit strange, any input here friends please ?

enter image description here

  • 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-05-21T16:39:53+00:00Added an answer on May 21, 2026 at 4:39 pm

    Well, this one suddenly got solved, I don’t know how.

    This is what I did. I copied and pasted codes of a different page where the excel thing was working. Then, I changed the variables manually to adapt this with the 2nd page.

    After some hit and try, it suddenly worked.

    Thanks for all the answers anyway.

    PS. By solved, I mean that excel is not crushing anymore, though I am still getting the confirm box about incorrect format.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been researching options for printing report-like data via a web application. Some
Why is this printing out 0 back in main but 6 when it is
Running this program is printing forked! 7 times. Can someone explain how forked! is
I'm printing a complicated swing application UI to a physical printer via an Airport.
I'm hoping that I can explain this well enough. I have an excel document
I have an Excel 2010 macro application that is made up of several workbook
I'm tasked with writing an application for placing and connecting objects (sort of like
I'm creating HTML (popup window), EXCEL and PDF report and would like to show
I'm having trouble formating the strings to utf-8 In this script im getting data
When printing an HTML table, you can use CSS to force the table's header

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.