OK. I know it should be simple but I'm just beginning what is going to be a long hard road to writing a silverlight App that does things with Excel. So appologies now for any dumb questions (and future questions)
So, a simple question; what is the best way to load an excel file, and where should that file be placed? CODE NEEDED.
Many TIA
Steve
Further to last for Devin and any others.
The .web project MUST be marked as the startup project.
This is so obscure that something as simple as this resolves the issue even when you click the 'go' button on the debugger and the project launches into a web browser.
Hope this helps anyone else wh has spent 5 hours trying to get a simple file in SilverLight to load from an external source asynchronously.
Devin further to the last, I have tried to refactor code down a bit to make it easier to debug, as in the following:
If you step through your code you will see that System.InvalidOperationException is being thrown on the wbURI objects properties.
Being a Silverlight newbie any ideas on resolving ?
Devin Hi.
This is exactly the type of example that I'm looking for. It did throw an error message and didn't complete so did this compile and run on your system?
2 things:
1) The reference that I have for the Excel Assembly is InfragisticsSL4.Excel.v10.2 and noted yours as being v10.3; and
2) The example throws an error message:
System.Reflection.TargetInvocationException was unhandled by user code Message=An exception occurred during the operation, making the result invalid. Check InnerException for exception details. StackTrace: at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at System.Net.OpenReadCompletedEventArgs.get_Result() at LoadReportExcelFile.Home.client_OpenReadCompleted(Object sender, OpenReadCompletedEventArgs e) at System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e) at System.Net.WebClient.OpenReadOperationCompleted(Object arg) InnerException: System.Net.WebException Message=An exception occurred during a WebClient request. InnerException: System.NotSupportedException Message=The URI prefix is not recognized. StackTrace: at System.Net.WebRequest.Create(Uri requestUri) at System.Net.WebClient.GetWebRequest(Uri address) at System.Net.WebClient.OpenReadAsync(Uri address, Object userToken) InnerException: ....
Did you have this happen to you?
Is it an Assembly issue or something else?
Regards
Attached is an example that demonstrates loading an Excel workbook from the ClientBin, which I beleive is what your looking to do. If not let me know.
You will have to add a reference to the Infragistics.Excel assembly in the Silverlight project toi get the sample working.
Devin
Further to the last, I have had success based on the xls being compiled as an Embedded Resource; this is not the same as dynamically accessing it.
The reason for the loading requirement is to allow the owner of the xls to make changes and upload the file again. Effectively this would adhjust the business ruels/model.
Is there a way to load the file dynamically? A version flag would be contained in a cell as a comparitor for people uploading a changed file.