以编程方式将按钮添加到Excel单元格

时间:2013-01-16 14:50:55

标签: c# excel controls cell

有没有办法向特定单元格添加按钮?我设计了一个加载项,其中来自MySQL数据库的数据被转移到Excel。现在我想为每一行添加按钮或组合框等控件。 我已经尝试过这段代码了:

System.Windows.Forms.Button b = new System.Windows.Forms.Button();
sheet.Controls.AddControl(b, (sheet.Cells[rowidx, colidx] as Range),"buttonName");

但似乎sheet.Controls不可用。有人想过吗?

0 个答案:

没有答案