I have written a Web Service in C# using visual studio 2005. One of the functions is to generate reports using MS excel. The problem I have is the following.
While I am debugging the web service (running it directly from VS), the report generation works properly. If I publish the web service and run the report generation it fails with the following error.
"Unable to set the PrintTitleRows property of the PageSetup class".
I have made sure all of the Interop DLL's (e.g. Interop.Excel.dll etc) are copied to the remote web server as well as the same version of MS office being installed as on the development machine (2003 professional).
I have even installed VS2005 and debugged the application on the remote server. The report generation works when the Web Service is run from VS but failed when published.
As anyone got any idea as to what is going on here?
Sample of the code:
Excel.ApplicationClass excelApp;
Excel.Workbook newWorkbook;
excelApp = new Excel.ApplicationClass();
Excel._Worksheet oSheet;
Excel.Range oRng;
excelApp.Visible = false;
newWorkbook = excelApp.Application.Workb
ooks.Add(T
ype.Missin
g);
oSheet = (Excel._Worksheet)newWorkb
ook.Active
Sheet;
oSheet.Name = RepFormat.ReportReference;
oSheet.PageSetup.PrintTitl
eRows = "$1:$3"; // This line fails
Start Free Trial