Skip to main content
Participating Frequently
Jul 28, 2016 7:46 PM UTC
Question

CFCONTENT

The code is no longer worked on some Chrome/IE browsers. It will open Excel but nothing loads.

<cfheader name="Content-Disposition" value="inline; filename=Report.xls">

<cfcontent type="application/vnd.msexcel">

    This topic is closed to new replies. Start a new post to keep the conversation going.

    11 replies

    cphamAuthor
    Participating Frequently
    Aug 3, 2016 5:06 PM UTC

    I’ve changed the settings for Excel. And it loads.

    Trust Center> Trust Center Settings > Protected View. Unchecked -  Enable Protected View for files originating from the Internet.

    Translate
    EddieLotter
    Inspiring
    Aug 3, 2016 5:19 PM UTC

    That is what BKBK​ said in a previous post, but it's worth heeding his bolded warning. It's also worth noting that if this is not an internal app then you have no control over your external users' computer settings.

    Cheers

    Edde

    Translate
    BKBK
    Community Expert
    Community Expert
    Jul 30, 2016 2:31 PM UTC

    cpham wrote:

    The code is no longer worked on some Chrome/IE browsers. It will open Excel but nothing loads.

    <cfheader name="Content-Disposition" value="inline; filename=Report.xls">

    <cfcontent type="application/vnd.msexcel">

    The correct MIME type for XLS files is application/vnd.ms-excel.

    Translate
    cphamAuthor
    Participating Frequently
    Jul 29, 2016 2:04 PM UTC

    Unfortunately, it didn't work. This issue just started this week. It was working fin before.

    The reason why using a table is to populate is the user has two options to view report: Browser or Excel.

    Translate
    BKBK
    Community Expert
    Community Expert
    Jul 30, 2016 3:33 PM UTC

    cpham wrote:

    Unfortunately, it didn't work. This issue just started this week. It was working fin before.

    I can imagine that the problem started only recently. The cause is likely to be Microsoft Office's security update of July 12, 2016.

    One workaround to enable you to view the contents of the Excel file is as follows:

    Go to

    Excel Options => Trust Center => Trust Center Settings => Protected View

    => Uncheck the checkbox "Enable Protected View for files originating from the Internet".

    Warning:

    Use the suggestion I have given here at your own risk. Microsoft put the security settings in place for a reason.

    This workaround is only a temporary solution, to be used for connections you trust. Return the settings to their most secure level afterwards.

    Translate
    WolfShade
    Legend
    Jul 29, 2016 1:32 PM UTC

    Swap out your CFCONTENT with the following, and let me know if it works.

    <cfcontent type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">

    HTH,

    ^_^

    UPDATE:  Upon further viewing of the thread, so far, I am curious.  I've never tried using a table to populate an Excel sheet.  I've always dropped to CFSCRIPT and used the SpreadsheetNew() function.  If you use SpreadsheetSetCellValue(), you get granular control over data and format, and can do some pretty spiffy stuff.

    Translate
    BKBK
    Community Expert
    Community Expert
    Jul 30, 2016 2:32 PM UTC

    WolfShade wrote:

    Swap out your CFCONTENT with the following, and let me know if it works.

    1. <cfcontenttype="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">

    That looks like the one for XLSX files.

    Translate
    EddieLotter
    Inspiring
    Jul 28, 2016 8:42 PM UTC

    If "nothing loads" then you're probably not emitting anything that Excel can interpret.

    I use this type of scenario for certain reports and it works in Chrome, IE 11 and Chrome under Windows 10.

    To troubleshoot, comment out the two lines that you showed and then browse to the page. What do you see in your Web browser?

    Cheers

    Eddie

    Translate
    Known Participant
    Jul 29, 2016 10:59 AM UTC

    I am using Coldfusion 11 Standard and this exact same thing started happening about a week ago with me. MS Excel will open but nothing loads.  if i open the same .xls file with Open Office or even MS Word it will actually display the data.

    Translate