Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

unable to open excel file stored from document library to file system !!

$
0
0

Hello,

I am facing wiered issue on my windows 7 system as below :

I have saved excel file from document library to file system at below folder :

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

I read excel file using below syntaxt

 Microsoft.Office.Interop.Excel.Application _excelApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook xlWorkbook = _excelApp.Workbooks.Open(@"C:\Windows\SysWOW64\config\systemprofile\Desktop\" + excelname,
                                                                                Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                                                                                Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                                                                                Type.Missing, Type.Missing, Type.Missing, Type.Missing);

At second line , It throws below error :

An exception of type 'System.Runtime.InteropServices.COMException' occurred in <Project DLL> but was not handled in user code

Additional information: Microsoft Excel cannot access the file 'C:\Windows\SysWOW64\config\systemprofile\Desktop\Myexcel.xlsx'. There are several possible reasons:

• The file name or path does not exist.

• The file is being used by another program.

• The workbook you are trying to save has the same name as a currently open workbook.

Note :

1. Code runs under run with elevated priviledges

2. Folder is having full control permission for appPool account

3. Above error get throw on windows 7 machine but not on server 2008

Please help me to resolve this issue.

Thanks and Regards,




Dipti Chhatrapati




Viewing all articles
Browse latest Browse all 11508


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>