Hi,
I am using export to excel from XamWebGrid. I did formatting for percentage and for doller signn like below
for example
tempvalue=24%
if (tempvalue.ToString().Contains("%"))
{
tempvalue = tempvalue.ToString().Replace(
}
Now i am getting value like -$4500. I want to format it as -$4500 and also when click . it should display -ve value in formula bar upper part of excel.
So please give any solution for that.
Thanks,
Nandkishor
Hello,
Is there any way to show negative values. like -$3000 in excel cell and when click on that value it should display -3000 in formula bar at upper side in excel sheet.
Nandu
Hi Nandu,
You can format Excel cell values by assigning an acceptable format string.
In your case you should use a string, similar to the one from the code snippet below, thus dispalying any number as currency.
cell.Value = -3000;
cell.CellFormat.FormatString = "$0000.00";
Save your Workbook as a file, open it, observe. I hope you get the target behavior.
Stefana
We don't offer a way to get the formatted value.
However you can apply it yourself:
String.Format(culture, col.FormatString, value)
Hope this helps,
-SteveZ
Hi Stefana, Is there any way to get Formated Value from related cell?
if I have use same code as:cell.Value = 1234.123;cell.CellFormat.FormatString = "$0,000.00";
then is it possible that it may return us "$1,234.12" in runtime not in exported file in Excel.
Thanks