Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
请将下列代码放按钮中测试,红色代码
Dim Book As New XLS.Book '定义一个Excel工作簿
Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
Sheet.DefaultColumnWidth = 122 '设置列宽
Sheet.DefaultRowHeight = 155 '设置行高
For r As Integer = 0 To e.Form.Controls("TextBox1").Value '向工作表的单元格中设置值
For c As Integer = 0 To e.Form.Controls("TextBox1").Value '向工作表的单元格中设置值
Dim n As Integer=e.Form.Controls("TextBox1").Value+1
Sheet(r,c).Value = (r+n*c)
Next
Next
Book.Save("c:\0913.xls") '保存工作簿
Dim Proc As New Process
Proc.File = "c:\0913.xls"
Proc.Start()
改成这样就好了
Sheet.Cols(c).Width = 122
Sheet.Rows(r).Height =155