您的位置:首页 > 其它

【Spread for Web Forms】CurrencyCellType隐藏货币符

2008-07-11 11:29 267 查看
一开始用GeneralCellType能实现隐藏货币符($),同时格式化数字(###,###,##0),但是却失去了ErrorMessage的功能,不能判断可输入最大值最小值。

Dim dCell As New FarPoint.Web.Spread.GeneralCellType

Dim numFormat As New System.Globalization.NumberFormatInfo

numFormat.NumberDecimalDigits = 0

dCell.NumberFormat = numFormat

dCell.FormatString = "n"

参考以下方法

t=System.Threading.Thread.CurrentThread;

oldCulture=t.CurrentCulture;

System.Globalization.CultureInfo newci = (System.Globalization.CultureInfo)oldCulture.Clone();

newci.DateTimeFormat.DayNames=new string[]{"日","一","二","三","四","五","六"};

newci.DateTimeFormat.FirstDayOfWeek=DayOfWeek.Sunday;

t.CurrentCulture=newci;

作成以下解决方案

Private t As System.Threading.Thread

Private oldCulture As System.Globalization.CultureInfo

Private Sub FPspread1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles ssList.PreRender

t = System.Threading.Thread.CurrentThread

oldCulture = t.CurrentCulture

Dim newci As System.Globalization.CultureInfo = DirectCast(oldCulture.Clone(), System.Globalization.CultureInfo)

newci.NumberFormat.CurrencySymbol = ""

newci.NumberFormat.NumberDecimalDigits = 0

t.CurrentCulture = newci

End Sub

知识点:

System.Globalization 命名空间包含定义区域性相关信息的类,这些信息包括语言、国家/地区、使用的日历、日期、货币和数字的格式模式以及字符串的排序顺序。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: