回复 1楼xujingtian的帖子
你好,
1.样式信息的复制需要通过后台来做,Spread 提供了多种模型来存储设置单元格样式:DefaultSheetSpanModel 用于存储合并信息;DefaultSheetStyleModel 用于存储其他样式信息。参考代码:
- protected void Page_Load(object sender, EventArgs e)
- {
- if (IsPostBack)
- {
- return;
- }
- this.FpSpread1.Sheets[0].RowCount = 10;
- FarPoint.Web.Spread.Model.DefaultSheetStyleModel styleModel = (FarPoint.Web.Spread.Model.DefaultSheetStyleModel)FpSpread1.Sheets[0].StyleModel;
- FarPoint.Web.Spread.StyleInfo style = new FarPoint.Web.Spread.StyleInfo();
- style.HorizontalAlign = HorizontalAlign.Right;
- style.BackColor = Color.Yellow;
- styleModel.SetDirectInfo(0, 0, style);
- FarPoint.Web.Spread.Model.DefaultSheetSpanModel spanModel = (FarPoint.Web.Spread.Model.DefaultSheetSpanModel)FpSpread1.Sheets[0].SpanModel;
- spanModel.Add(0, 0, 1, 2);
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- FarPoint.Web.Spread.Model.DefaultSheetStyleModel styleModel = (FarPoint.Web.Spread.Model.DefaultSheetStyleModel)FpSpread1.Sheets[0].StyleModel;
- styleModel.Copy(0, 0, 5, 0, 1, 1);
- FarPoint.Web.Spread.Model.DefaultSheetSpanModel spanModel = (FarPoint.Web.Spread.Model.DefaultSheetSpanModel)FpSpread1.Sheets[0].SpanModel;
- spanModel.Copy(0, 0, 5, 0, 1, 1);
- }
复制代码
2.当前后台设置样式动作还不能撤销,需要通过后台代码修改。
3.不分页可以通过设置 SheetView AllowPage 属性为 false 实现。 |