 |
|
| .NET DotNet Forum Index » Visual C# Forum » C# and Excel... |
|
Page 1 of 1 |
|
| Author |
Message |
| Bhavin Parekh... |
Posted: Mon Nov 02, 2009 5:27 pm |
|
|
|
Guest
|
Hi
I'm using C# (Framework 2.0) and trying to calling excel function using
below dummy code.
It works fine as long as array size of object type array is under 65500 but
as soon as i increase, it throws an error.
Code:
object[] obj = new object[65500];
long indx = 0;
while (indx<65500)
{
obj[indx] = indx;
indx++;
}
Microsoft.Office.Interop.Excel.Application xl = new
Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.WorksheetFunction wsf = xl.WorksheetFunction;
double result = wsf.Percentile(obj, 0.75);
When i increase the size e.g. 65600, it throws below run time error,
Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))
Please anyone can help on this? Is there any workaround to resolve this
issue?
Thanks |
|
|
| Back to top |
|
|
|
| Family Tree Mike... |
Posted: Mon Nov 02, 2009 5:41 pm |
|
|
|
Guest
|
Bhavin Parekh wrote:
Quote: Hi
I'm using C# (Framework 2.0) and trying to calling excel function using
below dummy code.
It works fine as long as array size of object type array is under 65500 but
as soon as i increase, it throws an error.
Code:
object[] obj = new object[65500];
long indx = 0;
while (indx<65500)
{
obj[indx] = indx;
indx++;
}
Microsoft.Office.Interop.Excel.Application xl = new
Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.WorksheetFunction wsf = xl.WorksheetFunction;
double result = wsf.Percentile(obj, 0.75);
When i increase the size e.g. 65600, it throws below run time error,
Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))
Please anyone can help on this? Is there any workaround to resolve this
issue?
Thanks
MS Excel has a limit of 65535 rows, and the percentile function works on
a range. It seems that it treats your array as a set of rows, which
violates the row limit.
--
Mike |
|
|
| Back to top |
|
|
|
| Scott M.... |
Posted: Mon Nov 02, 2009 7:14 pm |
|
|
|
Guest
|
"Family Tree Mike" <FamilyTreeMike at (no spam) ThisOldHouse.com> wrote in message
news:OdCvc2AXKHA.844 at (no spam) TK2MSFTNGP05.phx.gbl...
Quote: Bhavin Parekh wrote:
Hi
I'm using C# (Framework 2.0) and trying to calling excel function using
below dummy code.
It works fine as long as array size of object type array is under 65500
but
as soon as i increase, it throws an error.
Code:
object[] obj = new object[65500];
long indx = 0;
while (indx<65500)
{
obj[indx] = indx;
indx++;
}
Microsoft.Office.Interop.Excel.Application xl = new
Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.WorksheetFunction wsf =
xl.WorksheetFunction;
double result = wsf.Percentile(obj, 0.75);
When i increase the size e.g. 65600, it throws below run time error,
Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))
Please anyone can help on this? Is there any workaround to resolve this
issue?
Thanks
MS Excel has a limit of 65535 rows, and the percentile function works on a
range. It seems that it treats your array as a set of rows, which
violates the row limit.
--
Mike
Actually, it's 65,536 rows in Excel 2000, 02, and 03. It's 1,048,576 in
Excel 2007.
-Scott |
|
|
| Back to top |
|
|
|
|
|
All times are GMT - 5 Hours
The time now is Mon Nov 30, 2009 12:27 am
|
|