Hi,
we have a problem with calling interop library from webservice. The webservice uses other dll where is called function 'Open'(mentioned below), if this dll is called from another exe then excel file is normally opened. Before than function 'Open' is called it's ensured the file does exist and it is not read-only. If the exe is called from Cassini we get the same error.
Cassini returns this kind of error:
Error Opening File 'D:\xls\Mappe1.xlsx'. Detail: Microsoft Office Excel kann auf die Datei 'D:\xls\Mappe1.xlsx' nicht zugreifen. Dies kann mehrere Gründe haben:
• Der Name des Dokuments oder der Pfad ist nicht vorhanden. (EN: doc name or path is not available)
• Das Dokument wird von einem anderen Programm verwendet. (EN: doc is used by another appl.)
• Der Name der Arbeitsmappe, die gespeichert werden soll, ist identisch zu dem Namen eines anderen Dokuments, welches schreibgeschützt ist. (EN: read-only problem)
public void Open(string fileName)
{
try
{
Worbooks.Add(App.Workbooks.Open(fileName,
true,
false,
System.Type.Missing,
System.Type.Missing,
System.Type.Missing,
System.Type.Missing,
System.Type.Missing,
System.Type.Missing,
false,
System.Type.Missing,
System.Type.Missing,
false,
System.Type.Missing,
System.Type.Missing));
_OpenFileName = fileName;
}
catch (Exception err)
{
throw new Exception(
String.Format(CultureInfo.InvariantCulture, "Error Opening File '{0}'. Detail: {1}", fileName, err.Message), err);
}
}
env.:
*UltiDev Web Server Pro Build 15 (v. 2.0.15) - running in 32 bit mode
*OS Windows Server 2008 R2 x64
*MS Office 2007 sp1 32b (Microsoft.Office.Interop.Excel.dll 11.0.5530.0, *Microsoft.Vbe.Interop.dll 11.0.5530.0)
*full local admin
Similar thread
http://ultidev.com/Forum...Problem-with-excel.aspx didn't fix our troubles.
Thanks a lot for feedback.