When using C # To export excel files, there is always a prompt:
The format of the file test.xls you try to open is inconsistent with the format specified by the file extension. Verify that the file is not damaged and the source is trusted before opening the file. Open the file now?
Click Yes to open it. However, this prompt is always displayed, which makes you feel uncomfortable.
Provides a solution that has been tested and is valid:
1. Close all office applications, open the registry, and enter regedit during running. You can use the shortcut key win + R to open the running window.
2. Locate HKEY_CURRENT_USER \ Software \ Microsoft \ Office \ 12.0 \ Excel \ Security
Click [new] on the [edit] menu, click the DWORD Value, ENTER ExtensionHardening, and press ENTER.
3. Right-click ExtensionHardening, click Modify, and enter 0 as the value. Click exit from the menu above.
Open the excel file and find that the prompt is missing.