We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Currency Format in Template

Hi, I''m trying to format a column in my excel documents to accept currency. I tried setting the format for the column in the template and then insert strings but it just comes out as a string. Is there another step I need to take to enter currency? Also, I am going to need to create a formula row that calculates the totals from a couple of the columns could you give me an example of the formula cell? Thanks Andy Johnson

1 Reply

AD Administrator Syncfusion Team April 4, 2004 11:13 PM

Hi Andy, The formatting is not applied when you insert strings into cells with currency format. If you want to insert strings use the value2 property. Here is the code snippet. If you have numbers then use number. Currently you must be using mySheet.Range["C1"].Text = "3"; Instead use this, mySheet.Range["C1"].Value2 = "3"; or mySheet.Range["C2"].Number = 4; Regarding the formula cell, you can enter the formula in the template. Then just fill the spreadsheet with the data. The resulting spreadsheet created using ExcelRW will have the values computed when you open it. I have attached a small sample demonstrating both currency format and formula cells. TemplateCurrencyCell_Forum_8207.zip A few notes on the sample 1) The cells C1:C4 were formatted as currency using template. 2) The formula for cells D1:D4 were set as A1+A2 , .....A4+D4. 3) A new formula is inserted in cell C3 using ExcelRW API. Hope i understood your requirements correctly. Please let me know if you have any other questions. Best regards, Stephen. >Hi, > >I''m trying to format a column in my excel documents to accept currency. I tried setting the format for the column in the template and then insert strings but it just comes out as a string. Is there another step I need to take to enter currency? > >Also, I am going to need to create a formula row that calculates the totals from a couple of the columns could you give me an example of the formula cell? > >Thanks >Andy Johnson

Loader.
Live Chat Icon For mobile
Up arrow icon