回复 1楼怕瓦落地的帖子
你好,
Spread 4.0 不支持NegativeRed属性,如果需要在 4.0 中实现可以通过前台 FpSpread1_EditStopped 事件获取当前单元格的值,再设置前景色。
- <script language="javascript" type="text/javascript" id="FpSpread1_Script0">
- function FpSpread1_EditStopped(event){
- //Add code to handle your event here.
- var spread=this.document.getElementById("FpSpread1");
- var col = spread.ActiveCol;
- var row = spread.ActiveRow;
- var cell = spread.Cells(row,col);
- var cellValue = spread.GetValue(row, col);
- if (cellValue < 0) {
- cell.SetForeColor("red");
- }
- else {
- cell.SetForeColor("Black");
- }
- }
- </script>
复制代码
后台代码:
- protected void Page_Load(object sender, EventArgs e)
- {
- if (IsPostBack)
- {
- return;
- }
- FarPoint.Web.Spread.DoubleCellType objNumCell = new FarPoint.Web.Spread.DoubleCellType();
- objNumCell.ErrorMessage = "error";
- objNumCell.DecimalDigits = 4;
- objNumCell.MinimumValue = -9999999999;
- objNumCell.MaximumValue = 9999999999;
- this.FpSpread1.ActiveSheetView.Cells[0, 0].CellType = objNumCell;
- }
复制代码 |