B
bhaskar_joardar
Guest
Hi,
I need to create an excel file from the database records. I fetched and put the data in an excel file and tried to save that file as follows.
string SavedFileName = Server.MapPath("../NLR/WIP/WIP_" + toDay + ".xls");
excelWorkbook.SaveAs(SavedFileName, Excel.
XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
killExcelProc();
//@@ and released the excell process withthe following function
protected
void killExcelProc()
{
foreach (System.Diagnostics.Process Proc in System.Diagnostics.Process.GetProcessesByName("EXCEL"))
{
Proc.Kill();
}
}
** Now in my XP machine IIS server it is running fine with out any problem. But in windows 2003 Server I am getting the following error
"
System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Office Excel cannot access the file 'D:\RadioSQA\NLR\WIP'. 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. at Excel.WorkbookClass.SaveAs(Object Filename, Object FileFormat, Object Password, Object WriteResPassword, Object ReadOnlyRecommended, Object CreateBackup, XlSaveAsAccessMode AccessMode, Object ConflictResolution, Object AddToMru, Object TextCodepage, Object TextVisualLayout) at Reports_WIP.btnWIP_Click(Object sender, EventArgs e)
"
When I opened task manager I didn't find any excel process running. I have given the full permission to the virtual directory (Deployed folder) for ASPNET user. I modified the DCOMConfig configeration (For XP it is ASPNET and for 2003 it is NETWORK SERVICE). I think my application is not being able to save the excel file in the application. But I don't know why.. Please give me light and also tell me what I will have to do.
Continue reading...
I need to create an excel file from the database records. I fetched and put the data in an excel file and tried to save that file as follows.
string SavedFileName = Server.MapPath("../NLR/WIP/WIP_" + toDay + ".xls");
excelWorkbook.SaveAs(SavedFileName, Excel.
XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
killExcelProc();
//@@ and released the excell process withthe following function
protected
void killExcelProc()
{
foreach (System.Diagnostics.Process Proc in System.Diagnostics.Process.GetProcessesByName("EXCEL"))
{
Proc.Kill();
}
}
** Now in my XP machine IIS server it is running fine with out any problem. But in windows 2003 Server I am getting the following error
"
System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Office Excel cannot access the file 'D:\RadioSQA\NLR\WIP'. 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. at Excel.WorkbookClass.SaveAs(Object Filename, Object FileFormat, Object Password, Object WriteResPassword, Object ReadOnlyRecommended, Object CreateBackup, XlSaveAsAccessMode AccessMode, Object ConflictResolution, Object AddToMru, Object TextCodepage, Object TextVisualLayout) at Reports_WIP.btnWIP_Click(Object sender, EventArgs e)
"
When I opened task manager I didn't find any excel process running. I have given the full permission to the virtual directory (Deployed folder) for ASPNET user. I modified the DCOMConfig configeration (For XP it is ASPNET and for 2003 it is NETWORK SERVICE). I think my application is not being able to save the excel file in the application. But I don't know why.. Please give me light and also tell me what I will have to do.
Continue reading...