回复 3楼iceman的帖子
根据给的例子,确实能出来那个样子了,我重新继承了个TextCellType ,代码如下:
[Serializable]
public class CTextCellType : FarPoint.Web.Spread.TextCellType
{
// 重写单元格绘制过程
public override Control PaintCell(string id, TableCell parent, FarPoint.Web.Spread.Appearance style, FarPoint.Web.Spread.Inset margin, object value, bool upperLevel)
{
if (value != null)
{
Table table = new Table();
table.GridLines = GridLines.None;
TableRow row = new TableRow();
// 根据指定的操作绘制单元格的内容,并将单元格的Value链接页面的访问参数
TableCell cell0 = new TableCell();
cell0.BorderStyle = BorderStyle.None;
DropDownList ddl = new DropDownList();
ddl.Items.Add(new ListItem("平成", "H"));
ddl.Items.Add(new ListItem("昭和", "S"));
ddl.Items.Add(new ListItem("大正", "T"));
ddl.Items.Add(new ListItem("明治", "M"));
ddl.Width = 50;
//ddl.ID = "ddlNengo";
cell0.Controls.Add(ddl);
row.Cells.Add(cell0);
TableCell cell1 = new TableCell();
cell1.BorderStyle = BorderStyle.None;
TextBox txt1 = new TextBox();
//txt1.ID = "txtYear";
txt1.Width = 50;
cell1.Controls.Add(txt1);
row.Cells.Add(cell1);
TableCell cell2 = new TableCell();
cell2.BorderStyle = BorderStyle.None;
cell2.Text = "年";
row.Cells.Add(cell2);
TableCell cell3 = new TableCell();
cell3.BorderStyle = BorderStyle.None;
TextBox txt2 = new TextBox();
//txt2.ID = "txtMonth";
txt2.Width = 50;
cell3.Controls.Add(txt2);
row.Cells.Add(cell3);
TableCell cell4 = new TableCell();
cell4.BorderStyle = BorderStyle.None;
cell4.Text = "月";
row.Cells.Add(cell4);
TableCell cell5 = new TableCell();
cell5.BorderStyle = BorderStyle.None;
TextBox txt3 = new TextBox();
//txt3.ID = "txtDay";
txt3.Width = 50;
cell5.Controls.Add(txt3);
row.Cells.Add(cell5);
TableCell cell6 = new TableCell();
cell6.BorderStyle = BorderStyle.None;
cell6.Text = "日";
row.Cells.Add(cell6);
TableCell cell7 = new TableCell();
cell7.BorderStyle = BorderStyle.None;
HyperLink link7 = new HyperLink();
link7.ImageUrl = "/Images/Detail.png";
cell7.Controls.Add(link7);
row.Cells.Add(cell7);
table.Rows.Add(row);
return table;
}
else
{
return base.PaintCell(id, parent, style, margin, value, upperLevel);
}
}
}
运行后确实能显示出来,但第一次点击单元格,会出现html代码,如下图:
1.jpg
(56.97 KB, 下载次数: 492)
|