You are not logged in.
This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.
Pages: 1
Topic closed
Hi Jing,
I found a difference between Excel behaviour and Reogrid in the SUM function (maybe in other ones).
If you use SUM(A1,A2,A3) and A2 is empty (cell has no instance), the result is empty.
If, in the same conditions, you use SUM(A1:A3), the result is correct.
When you have to add non adjacent cells, this can be a handicap.
Eric
Edit: Sorry, I just found same request of January the 18th, 2015... Anything new since the 0.8.8.5 version or I missed something?
Last edited by ebrouen (2015-06-05 18:10:29)
Offline
OK, let me check and fix this problem. Thanks for the information.
Jing
Offline
Hi Eric, there is a bug in built-in SUM function, instead please use the following one 'SUM_2' before the next version available.
Run this code once before using 'SUM_2' function:
unvell.ReoGrid.Formula.FormulaExtension.CustomFunctions["SUM_2"] = (cell, args) =>
{
double val = 0;
foreach (var arg in args)
{
if (arg is ReoGridRange)
{
cell.Worksheet.IterateCells((ReoGridRange)arg, (r, c, inCell) =>
{
val += inCell.Worksheet.GetCellData<double>(r, c);
return true;
});
}
else if (arg is ReoGridCell)
{
val += cell.Worksheet.GetCellData<double>((ReoGridPos)arg);
}
else if (arg is double)
{
val += (double)arg;
}
}
return val;
};
And the usage: (same as 'SUM' function)
var sheet = reoGridControl1.CurrentWorksheet;
sheet["B2"] = new object[] { 1, null, 3, 4 };
sheet["C4"] = new object[] { "'=SUM_2(B2:E2)", null, "=SUM_2(B2:E2)" };
sheet["C6"] = new object[] { "'=SUM_2(B2, C2, D2, E2)", null, "=SUM_2(B2, C2, D2, E2)" };
Test result:
Edit: Sorry, I just found same request of January the 18th, 2015... Anything new since the 0.8.8.5 version or I missed something?
No I think you didn't I missed something, could you provide the URL of previous request? I'd like to reply it.
Regards, Jing
Last edited by Jingwood (2015-06-07 02:05:36)
Offline
Hi Jing,
Thank's for the answer.
The previous request was here : https://reogrid.net/forum/viewtopic.php?id=72.
I used a workaround by testing in my code if the cell has instance, and if the cell's data is not null. For the moment, I can continue with it. But of course, I'm not the only user of this super control
Sorry to ask for it, but when do you plan to release the next version? (with user-defined format, I would love it! https://reogrid.net/forum/viewtopic.php?id=124)
Regards,
Eric
Offline
Thanks for the link. I'm working on preparing for the next release, I think it would be available within next week.
Offline
SUM function has been improvement in 0.8.9.2 version.
Offline
Pages: 1
Topic closed