Search code examples
c#excel-2013excel-2016

excel 2013 and 2016 not opening html reports


We have an application which on server side generates html table and allows the user to download report as xls files. The application returns data in html format but is saved as xls.

In last one week or so, the reports have stopped working. We get error message saying

Excel cannot open the file Report1.xls because the file format or file extension is not valid. Verfiy that the file has not been corrupted and that the file extension matches the format of the file.

Is there a workaround for this issue?


Solution

  • For anyone else having similar issue, we were able to get around this by doing the below workaround -

    You can make use of existing Trusted Locations capabilities in Excel 2010, 2013, and 2016 via File -> options -> Trust Center -> Trust Center Settings -> Trusted Locations.

    1. You can save the web html file to a trusted location on the local machine (Excel comes with a set of default trust locations). If you do not see the local folder location you trust for these files, then press “Add new location…” button and add it in the Trusted Location dialog. If the HTML document is in a trusted location the KB fix is not applied (e.g. the unsafe HTML file is not blocked).
    2. This approach may unblock you, but it carries some risk as files of any file type in Trusted Locations are fully trusted. If an attacker can drop files into the trusted location they can easily exploit users who open such documents. Be especially cautious when specifying a custom folder as a trusted location.

    This solution was found here - https://social.technet.microsoft.com/Forums/en-US/d2d84793-9920-45e3-baef-5027a4ac1ae0/kb3170008-for-office-2016-breaks-functionality-ms16088