About the requirements processing method for online preview word,excel,ppt,pdf.

Source: Internet
Author: User

Reference Document: Http://www.cnblogs.com/wolf-sun/p/3574278.html

I chose the scenario: Generate a PDF with an Office COM component first, and then preview the PDF document online using Pdf.js. In the process of writing a demo of the following two questions, in this record, I hope to help the brothers and sisters who encounter similar problems.

1. When you install Office Plus 2010 on a server, a permission error occurs when you use its COM component to generate a PDF

System.UnauthorizedAccessException:Retrieving the COM class factory for component with CLSID { 000209ff-0000-0000-c000-000000000046} failed due to the following error:80070005 Access is denied. (Exception from hresult:0x80070005 (e_accessdenied)).

The workarounds are:

1. Configuring the identity in Web. config

<system.web>
<authentication mode= "Forms" >
<forms name= "_authuserkey" cookieless= "usecookies" protection= "All" path= "/" Loginurl= "~/account/login" Defaulturl= "~/website/home/index" >
</forms>
</authentication>

<authorization>
<deny users= "?"/>
</authorization>
<identity impersonate= "true" Username= "Wdeploy" password= "123"/>

2. Configuring DCOM

Control Panel-"Management tools-" Component Services-"computer-" My Computer-"DCOM config-" found Microsoft Word document
After
Click Properties to open the Properties dialog box for this application.
2. Click the Identity tab and select Interactive User.
3. Click the Security tab, select Custom in the launch and activation permissions and access permissions groups, and then
Add an ASP. NET account and IUSER_ computer name, customize---Edit
* These accounts exist only if IIS is installed on the computer.
4. Make sure that each user is allowed access, and then click OK.
5. Click OK to close the DCOMCNFG.

If you do not see Microsoft Offfice Word in Component Services, you will need to reinstall Office.

2.WORD Application.Documents.Open function returns null for a workaround

DCOM config Setting for "Microsoft Office Word 97-2003 Document" Internal configuration is OK, but calling the Application.Documents.Open function or returning null. Here's a workaround:

Create a "Desktop" directory under the "C:\Windows\SysWOW64\config\systemprofile\" directory.

About the requirements processing method for online preview word,excel,ppt,pdf.

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.