怎样将datagrid中数据到处到execl中

类别:.NET开发 点击:0 评论:0 推荐:
1 引入Microsoft Excel 10.0 Object Library
  (项目->添加引用->Com)
2 Dim excelapp As New excel.Application
  Dim excelbook As excel.Workbook
  Dim excelsheet As excel.Worksheet
3 Set excelbook = excelapp.Workbooks.Open   (App.path & "\工程进度表.xls")
  excelapp.Sheets("sheet1").Select
  Set excelsheet = excelapp.Sheets("Sheet1")
4 excelsheet.Cells(2, 1) = ....
5 excelbook.Save
  excelapp.Visible = True
6 excelsheet.Columns(i).ColumnWidth = 5.38
  excelsheet.Rows(i).RowHeight = 51
7 Set excelapp = Nothing
  Set excelbook = Nothing
  Set excelsheet = Nothing

本文地址:http://com.8s8s.com/it/it43884.htm