Hi,
I want to calculate the sum of the column , but the rows are dynamic in no.
Like there may be 10 records or may be lesser or more.I want to dynamically calculate the sum of the column .
Kindly help me.
Thanks,
Mukund
Hi,
I want to calculate the sum of the column , but the rows are dynamic in no.
Like there may be 10 records or may be lesser or more.I want to dynamically calculate the sum of the column .
Kindly help me.
Thanks,
Mukund
Hi,
Well, you may do it, see the sample code below for your reference:
Workbook workbook = new Workbook(FileFormatType.Excel2007Xlsx);
Worksheet sheet=workbook.Worksheets.Add(“Test”);
sheet.Cells[0, 0].PutValue(11);
sheet.Cells[99999, 0].PutValue(22);
//Set the formula to get sum of the first column
sheet.Cells[0, 1].Formula="=SUM(A:A)";
workbook.CalculateFormula();
MessageBox.Show(sheet.Cells[0, 1].StringValue);
workbook.Save(@“c:\temp\test.xlsx”, FileFormatType.Excel2007Xlsx);