找回密码
 立即注册

QQ登录

只需一步,快速开始

sdwd_lhq

注册会员

9

主题

26

帖子

77

积分

注册会员

积分
77

活字格认证

sdwd_lhq
注册会员   /  发表于:2012-12-20 21:46  /   查看:6697  /  回复:6
如何将表的一列(数据型)格式为千位分割的格式?
如1234567.67 要显示“1,234,567.67 ”的格式

我定义列的格式如图,但不起作用为什么?

Snap1.jpg (46.74 KB, 下载次数: 718)

6 个回复

倒序浏览
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2012-12-21 11:49:00
沙发
回复 1楼sdwd_lhq的帖子

你可以使用 CurrencyCellType 类型:
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            FarPoint.Web.Spread.CurrencyCellType currcell = new FarPoint.Web.Spread.CurrencyCellType();
            currcell.MinimumValue = 1;
            FpSpread1.ActiveSheetView.Cells[1, 1].CellType = currcell;
        }
    }
回复 使用道具 举报
sdwd_lhq
注册会员   /  发表于:2012-12-21 16:41:00
板凳
回复 2楼dof的帖子

感谢回复,但这样数据前面就多了个“¥”,感觉怪怪的,能否不要这个符号?


快照4.jpg (25.71 KB, 下载次数: 681)
回复 使用道具 举报
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2012-12-21 17:45:00
地板
  1.         protected void Page_Load(object sender, EventArgs e)
  2.         {
  3.             if (!IsPostBack)
  4.             {
  5.                 System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();
  6.                 nfi.CurrencySymbol = "";

  7.                 FarPoint.Web.Spread.CurrencyCellType currcell = new FarPoint.Web.Spread.CurrencyCellType();
  8.                 currcell.MinimumValue = 1;
  9.                 currcell.NumberFormat = nfi;

  10.                 FpSpread1.ActiveSheetView.Cells[1, 1].CellType = currcell;

  11.             }
  12.         }
复制代码
回复 使用道具 举报
sdwd_lhq
注册会员   /  发表于:2012-12-23 14:40:00
5#
回复 4楼dof的帖子

人民币符号去掉了,但有点不解,如何设置保留2位小数?
我的代码保留2位小数无效:
      FarPoint.Web.Spread.CurrencyCellType cc = new FarPoint.Web.Spread.CurrencyCellType();
        System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();
        nfi.CurrencySymbol = "";
        nfi.CurrencyDecimalDigits = 2;
        nfi.NumberDecimalDigits = 2;
        cc.NumberFormat = nfi;

        FpSpread1.ActiveSheetView.Columns[6].CellType = cc;
        FpSpread1.ActiveSheetView.Columns[7].CellType = cc;
快照5.jpg (24.51 KB, 下载次数: 660)
回复 使用道具 举报
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2012-12-24 18:01:00
6#
回复 5楼sdwd_lhq的帖子
  1.     System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();
  2.     nfi.CurrencySymbol = "";
  3.     nfi.CurrencyDecimalDigits = 2;

  4.     FarPoint.Web.Spread.CurrencyCellType currcell = new FarPoint.Web.Spread.CurrencyCellType();
  5.     currcell.MinimumValue = 1;
  6.     currcell.NumberFormat = nfi;
  7.     currcell.FixedPoint = true;
  8.     FpSpread1.ActiveSheetView.Cells[1, 1].CellType = currcell;
  9.     FpSpread1.ActiveSheetView.Cells[1, 1].Value = 123.1;
复制代码
回复 使用道具 举报
sdwd_lhq
注册会员   /  发表于:2012-12-25 13:43:00
7#
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部