Microsoft Office Excel cannot access the file 'c:\inetpub\wwwroot\Timesheet\App_Data\Template.xlsx'

前端 未结 7 1594
死守一世寂寞
死守一世寂寞 2020-11-27 12:35

I have my code as follows :-

Microsoft.Office.Interop.Excel.Application oXL = null;
Microsoft.Office.Interop.Excel.Sheets sheets;
Application excel = new Mic         


        
7条回答
  •  萌比男神i
    2020-11-27 13:33

    Try this:

    1. Create the directory

    C:\Windows\SysWOW64\config\systemprofile\Desktop

    (for the 32-bit version of Excel/Office on a 64-bit Windows computer) or

    C:\Windows\System32\config\systemprofile\Desktop

    (for a 32-bit version of Office on a 32-bit Windows computer or a 64-bit version of Office on a 64-bit Windows computer).

    1. For the Desktop directory, add Full control permissions for the relevant user (for example in Win7 & IIS 7 & DefaultAppPool set permissions for user IIS AppPool\DefaultAppPool).

    Original post with answer:

    • Excel 2007 automation on top of a Windows Server 2008 x64

提交回复
热议问题