繁体中文
设为首页
加入收藏
当前位置:.Net技术首页 >> Asp.Net开发 >> 怎样将datagrid中数据到处到execl中

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

2007-06-15 08:00:00  作者:  来源:互联网  浏览次数: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...

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

责任编辑:admin
相关文章