Export HTML Table to Excel- Doesn't Open in Office 2010

后端 未结 8 1584
南方客
南方客 2020-12-08 15:40

I am using the following Javascript code to generate an excel on the fly, which converts HTML table to a spreadsheet.

The excel file does not open in Office 2010, sh

相关标签:
8条回答
  • 2020-12-08 15:41

    Microsoft patched Excel on Aug 9 to restore the original functionality. Scroll to post on Aug 9 in this thread for more info: https://social.technet.microsoft.com/Forums/en-US/d2d84793-9920-45e3-baef-5027a4ac1ae0/kb3170008-for-office-2016-breaks-functionality-ms16088?forum=officeitpro

    Updating Excel fixed the problem for me.

    0 讨论(0)
  • 2020-12-08 15:46

    We had the same issue too many complaints from our customers. We traced it to the Excel OFffice Security patch KB3115262 - https://support.microsoft.com/en-us/kb/3115262 Which came out July 12, 2016

    To work around the issue, we had customers make a change in their Excel to allow files from the internet.

    To fix: 1) Open Excel Go to File Options

    2) Click Trust Center -> Trust Center Settings

    3) Go to Protected View. there are 3 options that show that were all clicked

    We uncheck the first option that reads -- "Enable Protected View for files originating from the Internet"

    That fixed the issue. Perhaps not the best solution. I'm not sure why this particular KB broke this but I think perhaps the fact the file format is not expected and this setting are conflicting with each other.

    On a computer I have that doesn't have this KB installed, all those are checked and it still works fine (not blank but prompts file format is different) and I think shows in protected view.

    What led us to fact its not the content of the file is we noticed if we resave the file in notepad or notepad++ without making any changes, the file behaves fine so excel must be reading some property of the file rather than the content to block it.

    0 讨论(0)
  • 2020-12-08 15:54

    You are saving a file with HTML content as *.xls. Excel can open this but will normaly show a warning message:

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

    If that warning not occurs and the file is not opening, then maybe the

    DWORD Value ExtensionHardening in HKEY_CURRENT_USER\Software\Microsoft\Office\<version number>\Excel\Security is set to 2 in Windows Registry

    That means "Check the file name extension and the file type. If they do not match, do not open the file."

    See https://support.microsoft.com/en-us/kb/948615.

    Maybe your administrator has set this via Group Policy setting. If you are in an administrated network, ask your administrator.

    If you are administrator of your own, then look for that registry setting and change it to 1, the default.

    0 讨论(0)
  • 2020-12-08 16:01

    Instead of doing:

    We uncheck the first option that reads -- "Enable Protected View for files originating from the Internet" which is not safe

    Do this:

    Go to Properties of the file and click Unblock (If you know the file is safe).

    Image: Go to Properties of the file and click Unblock

    0 讨论(0)
  • 2020-12-08 16:01

    Possible fixes for the problem:

    Solution 1:

    1) Type Regedit in start menu

    2) Navigate to registry as,

    In the registry: HKEY_CURRENT_USER\Software\Microsoft\Office\\Excel\Security

    where =

     15.0 for Office 2013
     16.0 for Office 2016
     12.0 for Office 2010
    

    create a DWORD(32bit) value and name it: ExtensionHardening. The possible values are:

    0: Do not check the file name extension and
       the file type, and bypass the function of the warning message.
    
    1: Check the file name extension and the file type.
       If they do not match, display the warning message.
    
    2: Check the file name extension and the file
       type. If they do not match, do not open the file.
    

    Use 1 as the value.

    Solution 2:

    Right click on Excel -->Properties-->Unblock-->Ok.

    UnblockExcel

    SOlution 3

    Uninstall the updates:

    Windows Update KB3115272 (Excel 2016/64 bit)

    Windows Update KB3115262 (Excel 2013)

    Windows Update KB3115130 (Excel 2010)

    For more info about the issue .please refer the link below. https://social.technet.microsoft.com/Forums/en-US/d2d84793-9920-45e3-baef-5027a4ac1ae0/kb3170008-for-office-2016-breaks-functionality-ms16088?forum=officeitpro

    0 讨论(0)
  • 2020-12-08 16:05

    Similar issue, my code dumps from a GridView to an XLS file using StringWriter, HTMLTextWriter and RenderControl.

    Since our ASP.NET code runs on a company intranet we uninstalled the following updates across the company instead of going into 100s of user PCs and changing their settings.

    Uninstalled:

    • Windows Update KB3115262 (Excel 2013)
    • Windows Update KB3115130 (Excel 2010)
    • Windows Update KB3115272 (Excel 2016/64 bit)

    This fixed our issue, and would also fix yours and others affected by these updates.

    0 讨论(0)
提交回复
热议问题