Open GoogleCodeExporter opened 8 years ago
Try row[15].Cast<double?>();
Original comment by paulyo...@gmail.com
on 29 Jul 2011 at 3:53
I have tried this first but cell.Cast has check for null value and doesn't care
if type is nullable
Original comment by daniel.k...@gmail.com
on 29 Jul 2011 at 4:05
Original comment by paulyo...@gmail.com
on 29 Jul 2011 at 5:14
Hi Daniel,
I'm trying to reproduce this issue but cannot.
cell.Cast<double>() returns 0, which you don't want.
cell.Cast<double?>() return null because null is double? default's value.
Can you try cell.Cast<double?>() (with the question mark) and see if it returns
null for you.
Thanks for helping me out!
Original comment by paulyo...@gmail.com
on 14 Feb 2012 at 10:48
Invalid cast from 'System.Double' to 'System.Nullable`1[[System.Double,
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.
This is the error message trying to cast to 'double?' (i.e. nullable double).
Original comment by peduar...@gmail.com
on 1 Nov 2013 at 12:16
Convert.ToDouble(x["id"].ToString())
Original comment by Lai...@gmail.com
on 14 Aug 2014 at 12:33
[deleted comment]
Hi,
i had same issue as above and i tried above code and it worked as expected.
Could you please help me to solve below issue where i want to groupby and sum
value.
int sum = 0;
var groupp=from k in excelFile.Worksheet(sheetName).ToList() select k;
var grouped = groupp.GroupBy(row => row["Issue Type"]);
foreach (var g in grouped)
{
sum = g.Sum(t => Convert.ToInt32(t["Time Spent"]));
MessageBox.Show("key=" + g.Key + "sum=" + sum);
}
and it is displaying same value as it is in Excel column. its not displaying
Summed value and not grouping.. Find the attached screenshot
Original comment by sure05pa...@gmail.com
on 6 Oct 2014 at 4:25
Attachments:
Original issue reported on code.google.com by
daniel.k...@gmail.com
on 29 Jul 2011 at 12:55