System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a

T

tchaar

Hello,
I'm trying to create a web service that accesses an excel sheet saved
in xml using the Office Web Components available from Microsoft,
specifically OWC11. Everytime I set the XMLURL in the SpreadSheetClass
object, it bombs out on me telling me there is a COMEXCEPTION...

System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has
been returned from a call to a COM component.
at Microsoft.Office.Interop.Owc11.SpreadsheetClass.set_XMLURL(String
URL)
at tools.pricingSheet.getDefaultValues(String paramCountry, String
paramClientCateogory) in
c:\Inetpub\wwwroot\pricingSheetWS\App_Code\tools\pricingSheet.cs:line
35
at pricingSheetWS.getDefaultValues(String paramCountry, String
paramClientCategory) in
c:\Inetpub\wwwroot\pricingSheetWS\App_Code\pricingSheetWS.cs:line 23



Here is the code...

public static XmlDocument getDefaultValues(string paramCountry,string
paramClientCateogory)
{
SpreadsheetClass sp = new SpreadsheetClass();
String strCountry = paramCountry;
Worksheet wrksheet = null;
string strValue = null;
XmlDocument xmldoc = null;

sp.XMLURL = "pricingsheet/" + strCountry +
"_pricingsheet.xml";
wrksheet = (Worksheet)sp.Worksheets["Summary"];
wrksheet.Cells["B", "3"] = paramClientCateogory;
strValue = (string)wrksheet.Cells["B", "11"];

return xmldoc;
}

Thanks for all your help. I appreciate it.
 
A

Alvin Bruney [MVP]

try loading some very simple xml first as a test case, maybe some empty tags
and work your way up from there.

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top