Create Edit Microsoft Word (2003) [Configuration] in ASP.NET

xiaoxiao2021-03-06  54

Create Edit Microsoft Word (2003) [Configuration] in ASP.NET

These two days receive a task, some of which is to be able to generate a form of a unified Word document and save it in the server's fixed directory.

In order to achieve this feature, I saw a related article in Code Project:

Microsoft Word Documents from ASP.NET

In this article, the author details how to use ASP.NET to reference the Word component in the VS2003 environment, and construct a CCWORDAPP class to operate on Word, which covers a lot of basic operations. For this lazy person who is based on this built-in construction today is a good start.

So I didn't hesitate to use this class and applied to my program.

Since I used the Word COM component for the first time, there were many configurations on the use. There are also some code on the migration problem to create editing Microsoft Word (2003) [Principle] in ASP.NET.

Question one:

When I run, the following error occurs:

access denied.

Description: Execute an unprocessed exception during the current web request. Check the stack tracking information to learn more about the error and the code caused in the code.

Abnormal Details: System.unauthorizedAccessException: Rejects access.

ASP.NET is not authorized to access the requested resource. Consider grant the ASP.NET request ID access to this resource. ASP.NET has a base process identifier used when the application does not simulate (usually, {Machine} / aspnet on IIS 5, on IIS 6). If the application is passing through

Simulation, the identification will be an anonymous user (usually IUSR_MACHINENAME) or authenticated request users.

To grant ASP.NET write access to the file, right click on the file in the Explorer, select Properties, then select the Security tab. Click Add to add the appropriate user or group. Highlight the ASP.NET account, select the box corresponding to the required access.

Solution:

Add in Web.Config's node

Explanation

MS-help: //ms.vscc.2003/ms.msdnqtr.2003feb.2052/cpgenref/html/gngrfidentitysection.htm

Question 2:

When creating a new document or saves a modified document:

The code is: test.saves (configurationSettings.appsettings ["worddoc"] docname.text ".doc");

The following error occurred:

Unable to open macros.

Description: Execute an unprocessed exception during the current web request. Check the stack tracking information to learn more about the error and the code caused in the code.

Abnormal Details: System.Runtime.InteropServices.comException: Unable to open macros.

Solution:

Enter dcomcnfg in the run

In the component service à computer à my computer àdcom found:

Set boot and activation permissions and access to customizes

Add a MACHINENAME / ASPNET user in both

Identification to interactively

Now you can create a DOC documentation using ASP.NET.

转载请注明原文地址:https://www.9cbs.com/read-115481.html

New Post(0)