We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Need hlp with a silverlight error

I just installed a sharepoint silverlight wsp to my client and got the following error.
the strange thing is on my develop machine I do not get this error and the site is the same and data is the same?


 Unhandled Error in Silverlight Dagplanning Application [ArgumentOutOfRange_StartIndex]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=5.0.10411.00&File=mscorlib.dll&Key=ArgumentOutOfRange_StartIndex
Parameter name: startIndex   at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
   at System.String.Substring(Int32 startIndex, Int32 length)
   at Syncfusion.XlsIO.Implementation.RangeImpl.CellNameToRowColumn(String name, Int32& iRow, Int32& iColumn)
   at Syncfusion.XlsIO.Implementation.RangeImpl.CellNameToIndex(String name)
   at Syncfusion.XlsIO.Implementation.RangeImpl.ParseRangeString(String range, IWorkbook book, Int32& iFirstRow, Int32& iFirstColumn, Int32& iLastRow, Int32& iLastColumn)
   at Syncfusion.XlsIO.Implementation.RangeImpl.get_Item(String name, Boolean IsR1C1Notation)
   at Syncfusion.XlsIO.Implementation.RangeImpl.get_Item(String name)
   at Dagplanning.Reports.UitvoeringRapport.<>c__DisplayClass8.<OpenFile>b__1(Object s, OpenBinarySucceededEventArgs r)
   at Microsoft.SharePoint.Client.File.GetResponseCallback(IAsyncResult asyncResult)
   at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass19.<InvokeGetResponseCallback>b__17(Object state2)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

2 Replies

SM steve mangelschots January 25, 2013 02:23 PM UTC

Ok I got a little more results.
It seems that there is a difference between how the file was created on the live server then on the development server.

the file created on the live server is UI00683.xlsx and on the development server is UI00110.xlxs
the code I use is:

        private void OpenFile(Rapport rapport)

        {


            using (ClientContext client = new ClientContext(SharePointSettings.SiteUrl))

            {

                File.OpenBinaryDirect(client, "/Rapporten/Uitvoeringsdetail.xlsx", (s, r) =>

                {


                    try

                    {

                        ExcelEngine excelEngine = new ExcelEngine();

                        IApplication application = excelEngine.Excel;

                        IWorkbook workbook = application.Workbooks.Open(r.Stream,ExcelOpenType.SpreadsheetML2010);

                        //IWorksheet sheet = workbook.ActiveSheet;


                        //sheet.Range["klant"].Value = _uitvoering.Order.Project.Klant;

                        //sheet.Range["tel"].Value = _uitvoering.Order.Project.ContactGsm;

                        //sheet.Range["adres"].Value = string.Format("{0} {1} {2}", _uitvoering.Order.Project.Adres,

                        //                                           _uitvoering.Order.Project.Postcode,

                        //                                           _uitvoering.Order.Project.Plaats);


                        //int counter = 1;



                        //foreach (OrderDetail orderDetail in _uitvoering.Order.OrderDetails)

                        //{


                        //    if (orderDetail.Uitvoeren)

                        //    {


                        //        try

                        //        {




                        //            sheet.Range[sheet["type"].Row + counter, sheet["type"].Column].Value = orderDetail.Type;

                        //            sheet.Range[sheet["omschrijving"].Row + counter, sheet["omschrijving"].Column].Value = orderDetail.Omschrijving;

                        //            sheet.Range[sheet["opp"].Row + counter, sheet["opp"].Column].Value = ItemValue.ToString(orderDetail.M2Uitvoeren);

                        //            sheet.Range[sheet["dikte"].Row + counter, sheet["dikte"].Column].Value = ItemValue.ToString(orderDetail.Dikte);


                        //            counter++;

                        //        }

                        //        catch (Exception exception)

                        //        {

                                    

                        //           throw  new Exception("Error bij in instellen van de rapportlijnen", exception);

                        //        }


                           //}

                        //}

                        using (MemoryStream stream = new MemoryStream())

                        {

                            List documentList = client.Web.Lists.GetByTitle("Gedeelde documenten");

                            workbook.SaveAs(stream);

                            var fileCreation = new FileCreationInformation();

                            fileCreation.Content = stream.ToArray();

                            fileCreation.Overwrite = true;

                            fileCreation.Url = string.Format("{0}.xlsx", _uitvoering.UitvoeringNr);

                            File file = documentList.RootFolder.Files.Add(fileCreation);


                            client.Load(file);

                            client.ExecuteQueryAsync((s1, r1) => Deployment.Current.Dispatcher.BeginInvoke(() => OpenDocument(file.ServerRelativeUrl, client.Url)), (s1, r1) => { });

                        }



                    }

                    catch (Exception exception)

                    {


                        throw new Exception("Error bij rapport", exception);

                    }









                }, (s, r) =>

                {


                });

            }

        }


Anyone what am I doing wrong?



Downloads_c01c87fc.zip


RA Rajesh A Syncfusion Team January 28, 2013 07:10 AM UTC

Hi steve mangelschots,

  Thank you for using the Syncfusion Product,

From your code snippet, we could see that you are using the input file “Uitvoeringsdetail.xlsx”. We suspect that issue could be reproduced when try to get the range value from the workbook. So, could you please update the input file or issue reproduced sample. And also we have found the usage issue from your code, before save the workbook as stream please change the workbook version as Excel 2010.

Please let us know if you have any clarification,

Thanks and Regards,

Rajesh A.


Loader.
Live Chat Icon For mobile
Up arrow icon