回复 1楼yrpting的帖子
StyleName 用户设置单元格的样式,StyleName=“Locked” 中的 Locked 只是 NameStyle 的名称。参考代码:
- FarPoint.Win.Spread.NamedStyle ns = new FarPoint.Win.Spread.NamedStyle("StyleData", "DataAreaDefault");
- ns.BackColor = Color.LightBlue;
- ns.Border = new FarPoint.Win.LineBorder(Color.DarkBlue, 2);
- ns.CellType = new FarPoint.Win.Spread.CellType.TextCellType();
- ns.Editor = new FarPoint.Win.Spread.CellType.TextCellType();
- ns.Font = new Font("Comic Sans Serif", 12);
- ns.ForeColor = Color.Red;
- ns.Formatter = new FarPoint.Win.Spread.CellType.TextCellType();
- ns.HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Right;
- ns.Name = "StyleData";
- ns.Parent = "DataAreaDefault";
- ns.Renderer = new FarPoint.Win.Spread.CellType.TextCellType();
- ns.VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Bottom;
- fpSpread1.NamedStyles.Add(ns);
- fpSpread1.ActiveSheet.Cells[0, 0].StyleName = "StyleData";
- fpSpread1.ActiveSheet.SetText(0, 0, "NamedStyle");
- fpSpread1.ActiveSheet.Columns[0].Width = 120;
- fpSpread1.ActiveSheet.Rows[0].Height = 80;
复制代码
Cell 的 Locked 属性用于设置是否锁定单元格禁止用户编辑。
- fpSpread1.Sheets[0].Cells[0, 0].Locked = true;
复制代码 |