找回密码
 立即注册

QQ登录

只需一步,快速开始

iceman
社区贡献组   /  发表于:2012-5-21 11:38:00
11#

回复 10# study1990 的帖子

study1990 你好,
感谢楼主的提示,我重现了该问题,
原因为,Spread 默认单元格类型为 GeneralCellType ,当输入“0123” 时,Spread 会当作数值型进行处理,从而变为“123”,我们可以使用 TextCellType 来显示“0123”,测试代码:

  1. if (!IsPostBack)
  2.             {
  3.                 FarPoint.Web.Spread.TextCellType textType = new FarPoint.Web.Spread.TextCellType();
  4.                 FpSpread1.ActiveSheetView.Cells[0, 0].CellType = textType;
  5.             }
复制代码
回复 使用道具 举报
study1990
金牌服务用户   /  发表于:2012-5-21 14:45:00
12#

回复 11# iceman 的帖子

我在后台中对所有的单元格设定了TextCellType属性,但当我再添加一行后,又是GeneralCellType类型了,怎么样把不管怎么样添加的单元格都设定为TextCellType,或者对整个Spread设定一个参数来达到这个效果?
回复 使用道具 举报
study1990
金牌服务用户   /  发表于:2012-5-21 15:08:00
13#

回复 11# iceman 的帖子

我用了一个很没效率的方法:
FarPoint.Web.Spread.TextCellType textType = new FarPoint.Web.Spread.TextCellType();
var rc = FpSpread1.ActiveSheetView.RowCount;
var cc = FpSpread1.ActiveSheetView.ColumnCount;
FpSpread1.ActiveSheetView.Cells[0, 0, rc-1, cc-1].CellType = textType;
它在每次渲染时都会执行,新加的行或列也设定了此属性。
但点击CommandBar上自添加的单元格属性按钮设定货币属性时,属性设定失败,单元格仍是TextCellType的。
版主有没有好的方法?
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-5-21 16:35:00
14#
study1990 你好,
下面是我针对 12# 和 13# 制作的 Demo,请楼主参考:
WebApplication1.zip (1.67 MB, 下载次数: 183)
回复 使用道具 举报
study1990
金牌服务用户   /  发表于:2012-5-21 17:40:00
15#

回复 14# iceman 的帖子

FpSpread1.ActiveSheetView.DefaultStyle.CellType = textType;
只要这么设定,各单元格属性就正常了。
谢谢版主!:-D
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-5-21 17:40:00
16#

回复 15# study1990 的帖子

不客气哈,很高兴我的回答能够对楼主有所帮助。:-D
回复 使用道具 举报
study1990
金牌服务用户   /  发表于:2012-5-22 14:56:00
17#

回复 16# iceman 的帖子

对单元格设定货币属性后,Spread对单元格内容自动添加了<nobr>标签,但如果内容很长,多余部分就会被隐藏掉,怎么样不让它自添加<nobr>标签?
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-5-22 17:15:00
18#

回复 17# study1990 的帖子

study1990 你好,
不好意思,CurrencyCellType 无法实现该功能。给你带来不便,很抱歉。
回复 使用道具 举报
12
您需要登录后才可以回帖 登录 | 立即注册
返回顶部