回复 1楼峰行天下的帖子
峰行天下 你好,
1.如果文本为汉字,则可以自动折行,否则需要手动添加"\n"进行折行:
2.CheckBox Click 事件需要设置 autopostback属性为 true,在 FpSpread1_ButtonCommand 中获取。前台点击事件通过 OnClientClick 设置。
C#
- protected void Page_Load(object sender, EventArgs e)
- {
- if (IsPostBack)
- {
- return;
- }
- DataTable dt = new DataTable();
- dt.Columns.Add("col1",typeof(System.String));
- dt.Columns.Add("col2",typeof(System.Boolean));
- dt.Rows.Add("测试测试测试测试测试测试测试测试测试测试", false);
- dt.Rows.Add("testtestt\nesttesttesttestte\nsttesttestt", false);
- dt.Rows.Add("111111111111\n1111111111111111", false);
- this.FpSpread1.ActiveSheetView.DataAutoCellTypes = false;
- this.FpSpread1.ActiveSheetView.DataSource = dt;
-
- TextCellType tct = new TextCellType();
- tct.AllowWrap = true;
- tct.Multiline = true;
- this.FpSpread1.ActiveSheetView.Columns[0].CellType = tct;
- CheckBoxCellType cbct = new CheckBoxCellType();
- cbct.AutoPostBack = true;
- cbct.OnClientClick = "checkboxclick()";
- this.FpSpread1.ActiveSheetView.Columns[1].CellType = cbct;
- }
- protected void FpSpread1_ButtonCommand(object sender, SpreadCommandEventArgs e)
- {
- }
复制代码
JavaScript:
- <script type="text/javascript">
- function checkboxclick() {
- alert("test");
- }
- </script>
复制代码 |