sum formula is not working in GrapeCity fpspread cell

Posted by Santosh4u under Others on 6/9/2011 | Points: 10 | Views : 4823 | Status : [Member] | Replies : 7
hi
i m working on GrapeCity farpoint to generate the excel report without microsoft excel.

i want to use some formula in for calculation so i have a excel sheet having formula so i just binded excel sheet to fpspread but all the formula is working like divide etc but where ever excel sheet contains sum formula is not working.

so any boby tell me why sum is not woring,just i want to put some for first three cell and show in 4th cell.

it's very urgent


thanx
santosh




Responses

Posted by: Seanl on: 6/9/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

Your post does not contain enough information to determine the cause of the problem you describe.

Which version of Spread are you using? Can you post some sample code showing how you are using Spread? What development environment are you using?

Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Backwardshoop on: 6/9/2011 [Member] Starter | Points: 25

Up
0
Down
Hello,

Since some formulas are working and some are not, my guess is the data in the cells being referenced by the SUM function have strings. Make sure they are numbers and not string representation of numbers. SUM(A1:A3) with the values of "3", "5", "7" will not work. Even if one of the values are strings, the formula will not work. If this is not the case, then the answers to Sean's questions would be most helpful.

Scott Shorter
GrapeCity PowerTools

Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Susanthampy on: 6/9/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi

check this,

http://www.evget.com/zh-CN/product/835/feature_en.aspx

Regards,
Susan

Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santosh4u on: 6/9/2011 [Member] Bronze | Points: 25

Up
0
Down
hi all
i m elaborate my doubt clearly...
Step 1 : i have draged a fpspread(fpspread1) into my form .

step 2 : i m just binding a excel sheet to the fpspread1.
fpspread1.OpenExcel("D:\santosh\dailyplan.xls")
and this excel contains some formula like
Eth column contains sum formula i.e =SUM(B:D)
means if 2th row then E2=SUM(B2:D2),3th row then E3=SUM(B3:D3) so on........

Step 3:now through code i m writhing the values in column B,C,D and now E Column should show the sum of B,C and D as per the above formula but it's not showing the Eth column value is showing zero.

code using to writing the values in column (B,C and D ) using for loop and values is writing properly.
FpSpread1.ActiveSheet.Cells(RowNumber - 1, ColumnNumber - 1).Value = CStr(dsSummary.Tables(0).Rows(i)("Shells"))

Note:after binding the excel sheet in the FpSpread1 if i typing the value directly in the fpspread1 column B,C and D then it's showing the sum correctly in E column but through code it's not working.
hope now u guys will be clear abt my doubt..


regards
Santosh

Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santosh4u on: 6/10/2011 [Member] Bronze | Points: 25

Up
0
Down
hi Backwardshoop
all the columns are number as it's working in direct entry fpspread1 column and same formula is working in excel also..

regards
santosh

Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santosh4u on: 6/10/2011 [Member] Bronze | Points: 25

Up
0
Down
hi
what si code to convert the cell datatype from string to number in fpspread ..

regards
santosh

Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Backwardshoop on: 6/10/2011 [Member] Starter | Points: 25

Up
0
Down
Hello,

There is nowhere in Spread code to convert strings to numbers. If you are using the OpenExcel method to load the data into the Spread, then this should be working. But then you showed this line of code for assiging data to the Spread.

FpSpread1.ActiveSheet.Cells(RowNumber - 1, ColumnNumber - 1).Value = CStr(dsSummary.Tables(0).Rows(i)("Shells"))

This is putting data into the cells as strings and would cause the issue you are seeing. You need to convert the value read from the DataTable to a number type and assign the number into the Value property of the cell.


Scott Shorter
GrapeCity PowerTools

Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response