We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1888
    • 9 Posts
    I am trying to set the content type of a page to excel by doing the foll:

    1. put header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=$fileName"); in the snippet
    2. specify content-type as "text/html" in the content-type drop down in modx for the page

    It works but the problem is that opening the downloaded excel sheet gives a message "The file is in a different format than specified by the extension. do you want to open the file?". Also the grid lines are missing from the sheet.

    I assume this is because the content type is specified as text/html in modx.

    Is there any way to specify a content type other than the drop down options? maybe a hack in the modx code?
    Or is there something else that is wrong and how do i fix it?

      • 6726
      • 7,075 Posts
      No need to hack, you can add content-types : in the manager go to Tools > Configuration >> Custom content type and add what you need smiley
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 1888
        • 9 Posts
        how silly of me, i didnt see that at all. embarrassed
        thanks smiley

        but even setting the content type as "application/vnd.ms-excel" didnt help me get rid of that "The file is in a different format than specified by the extension. do you want to open the file?" message when i try to open the downloaded file.
        any idea what else could be the problem?