سؤال

We currently use SpreadsheetGear in one of our applications for generating Excel workbooks. I'm trying to reuse some of that functionality in an ASP.NET web application, but so far I'm stumped.

I started off by referencing our existing library in the web application and making the appropriate call but I ended up receiving an IndexOutOfRangeException.

I thought it might be a problem in our code, so I reduced the problem down to a WebForms page that just calls the following (which is, incidentally, the first line of code that is in the SpreadsheetGear web forms example):

SpreadsheetGear.IWorkbook workbook = SpreadsheetGear.Factory.GetWorkbook();

But I'm still getting the exact same problem. I've no idea what array is out of bounds because it's coming from inside the obfuscated part of SpreadsheetGear.

Stack trace:

[IndexOutOfRangeException: Index was outside the bounds of the array.]
   ᦿ..ctor(CultureInfo A_0) +2235
   ᦿ..cctor() +27994

Has anyone else seen this problem before?

هل كانت مفيدة؟

المحلول

I dug into this a bit further, and the problem turned out to be something we were setting in Application_BeginRequest.

We had some code that was doing some work to figure out which locale to use (based on a load of things such as what we could support and the languages supported by the user's browser). As part of that we were setting the NumberFormat.NumberGroupSeparator to an empty string. Turns out SpreadsheetGear doesn't like that and caused the exception above.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top