When Microsoft. Office. Interop. Excel is used, the 64-bit problem occurs.
Not long ago, I encountered a problem. In the past, Microsoft. Office. Interop. Excel was used to export the Excel file. After it was migrated to a 64-bit server, it was shown:
Failed to retrieve components whose CLSID is {00024500-0000-0000-C000-000000000046} in COM class factory
The following solutions are available for users on the Internet:
After installing the office on a 64-bit machine, make the following settings.
1: Enter dcomcnfg.exe in "start"-> "run" to start "Component Service"
2: Double-click "component service"> "computer"> "my computer"> "DCOM configuration"
3: Find "Microsoft Excel application" in "DCOM configuration", right-click it, and then click "properties". The "Microsoft Excel application properties" dialog box is displayed.
If Microsoft Excel is not available, replace the first step with comexp. msc-32.
4: click the "ID" tab and select "Interactive User"
5. Click the "Security" tab, click "Custom" on "Start and activate Permissions", and then click the corresponding "edit" button, in the pop-up "security" dialog box, add a "network service" user (note that you must select the computer name) and grant it the "local start" and "Local activation" permissions.
6: the "Security" label remains. Click "Custom" on "Access Permissions", and then click "edit ", in the pop-up "security" dialog box, add a "network service" user and grant "local access" permission.
Or both network service and everyone add settings.
I tried to solve the problem by following the above steps.
However, it is always inconvenient. Who can install the office once for this function, so it is best not to use Microsoft. Office. Interop. Excel to import and export EXCEL. Use another method. For other excel export methods, see the following document.
C # Microsoft tofficeinteropexcel: date reading in excel
1. DateTime dt = DateTime. FromOADate (39815.0 );
2. Use the Range. Value2 attribute to access the cell value. Do not use the Text attribute.
3. Range has no Value attribute. Microsoft. Office. Tools. Excel. NamedRange has a Value attribute.
An issue with aspnet MicrosoftOfficeInteropExcelWorkbooks exporting EXCEL
Debug and check the values in each file.