for (int j = 0; j < fp.ActiveSheetView.ColumnCount; j++) { fp.ActiveSheetView.ColumnHeader.Cells[0, j].Background.BackgroundImageUrl = "../../image/warning.png"; fp.ActiveSheetView.ColumnHeader.Cells[0, j].Background.BackgroundRepeat = "no-repeat"; fp.ActiveSheetView.ColumnHeader.Cells[0, j].Background.BackgroundPosition = "Left"; fp.ActiveSheetView.ColumnHeader.Cells[0, j].Note = "第" + j.ToString() + "列"; }
在初始化Fpspread的时候设置表头的Node属性
protected override void Render(HtmlTextWriter writer) { Table cht = this.FpSpread1.FindControl("cht") as Table; for (int j = 0; j < FpSpread1.ActiveSheetView.ColumnHeader.Columns.Count; j++) { if (FpSpread1.ActiveSheetView.ColumnHeader.Cells[0, j].Background.BackgroundImageUrl == "../../image/warning.png") { cht.Rows[0].Cells[j].Attributes.Add("title", FpSpread1.ActiveSheetView.ColumnHeader.Cells[0, j].Note); } } base.Render(writer); }
在Render中把Note值给title