When Microsoft. Office. Interop. Excel is used, the 64-bit problem occurs.

Source: Internet
Author: User

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.
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.