【Spread for Web Forms】CurrencyCellType隐藏货币符
一开始用GeneralCellType能实现隐藏货币符($),同时格式化数字(###,###,##0),但是却失去了ErrorMessage的功能,不能判断可输入最大值最小值。
参考以下方法
作成以下解决方案
知识点:
System.Globalization 命名空间包含定义区域性相关信息的类,这些信息包括语言、国家/地区、使用的日历、日期、货币和数字的格式模式以及字符串的排序顺序。
Dim dCell As New FarPoint.Web.Spread.GeneralCellType
Dim numFormat As New System.Globalization.NumberFormatInfo
numFormat.NumberDecimalDigits = 0
dCell.NumberFormat = numFormat
dCell.FormatString = "n"
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;
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
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 命名空间包含定义区域性相关信息的类,这些信息包括语言、国家/地区、使用的日历、日期、货币和数字的格式模式以及字符串的排序顺序。
本作品采用 知识共享署名-非商业性使用 2.5 中国大陆许可协议进行许可。 |