To use the preceding method, you must configure DCOM to grant you the permission to use the office.
The configuration method is as follows:
1: Install the Excel software for office on the server.
2: Enter dcomcnfg.exe in "start"-> "run" to start "Component Service"
3: Double-click "component service"> "computer"> "my computer"> "DCOM configuration"
4: Find the Microsoft Excel application in "DCOM configuration ".Program", Right-click it, and then click" properties ". The" Microsoft Excel application properties "dialog box is displayed.
5. Click the "ID" tab and select "Interactive User"
6. 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.
7: 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.
In this way, we have configured the corresponding Excel DCOM permissions.
Note: I configured it on win2003 and configured the ASPNET user on 2000.
If no configuration is performed, an error occurs.
Failed to retrieve components whose CLSID is {00024500-0000-0000-c000-000000000046} in the com class factory because of the following error: 80070005.
The reason is that the user does not have the permission to use Excel.
To export to word, you also need to configure the permission to use word.