Vb.net表格输出 vbnet formatnumber

在VB.net中,如何使几个数组变量按照列表示出来,并输出到指定的EXCEL表格中!先在: My Project 中引用 Microsoft Excel 11.0 Object Library(这个是Excel 2003 , Excel 2007 是12.0),之后在窗体代码中加入相关内容就行了 。以下是一个窗体的简单实例
假设在C盘根文件夹中有:TEST.xls
Public Class 引用EXCEL窗体
Private A() As String = {"A", "B", "CC", "C", "D"}
Private B() As Integer = {1, 22, 34, 50, 16, 99, 14}
Private excelapp As New Microsoft.Office.Interop.Excel.Application
Private excelworkbook As Microsoft.Office.Interop.Excel.Workbook
Private Sub 引用EXCEL_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Index As Integer
excelworkbook = excelapp.Workbooks.Open("c:\test.xls")
excelapp.Application.Workbooks.Add(True)
excelapp.Cells(1, 1) = "数组:A"
For Index = 0 To UBound(A)
excelapp.Cells(Index + 2, 1) = A(Index)
Next
excelapp.Cells(1, 2) = "数组:B"
For Index = 0 To UBound(B)
excelapp.Cells(Index + 2, 2) = B(Index)
Next
excelapp.Visible = True
End Sub
End Class
运行结果:
数组:A 数组:B
A 1
B 22
CC 34
C 50
D 16
99
14
vb.net 输出 excel这里有段VB6.0的,你可以参考 。
注意添加引用 。
Private Sub Command6_Click()
【Vb.net表格输出 vbnet formatnumber】 Dim i, j As Integer
Dim xlApplication As Excel.Application, xlWorkbook As Excel.Workbook, xlSheet
Dim xlApp As Excel.Application
On Error Resume Next
Set xlApplication = GetObject(, "Excel.Application")
Set xlApp = CreateObject("Excel.Application")
If MsgBox("确认将文件信息导出到EXCEL中??", vbExclamation + vbYesNo, "警告") = vbYes Then
If Err.Number0 Then Set xlApplication = CreateObject("Excel.Application")
Set xlWorkbook = xlApplication.Workbooks.Add
Set xlSheet = xlWorkbook.ActiveSheet
xlSheet.Cells(1, 2) = lblcl.Caption
xlSheet.Range("A1:E1").MergeCells = True
xlSheet.Range("A1:E1").HorizontalAlignment = xlCenter
xlSheet.Cells(2, 2).ColumnWidth = 18
For i = 1 To DataGrid1.Columns.Count
xlSheet.Cells(2, 1) = "编号"
xlSheet.Cells(2, i + 1) = DataGrid1.Columns(i).Caption
For j = 0 To DataGrid1.VisibleRows - 1
xlSheet.Cells(j + 3, 1) = j + 1
xlSheet.Cells(j + 3, i + 1) = DataGrid1.Columns(i).CellText(DataGrid1.RowBookmark(j))
Next j
Next i
xlApplication.Visible = True
Set xlSheet = Nothing
Set xlWorkbook = Nothing
Set xlApplication = Nothing
'xlApp.Range("A2:L2").Columns.Interior.ColorIndex = 40
'xlApp.Range("A2:L2").Borders.LineStyle = xlContinuous
'xlApp.Visible = True
'xlApp.Range(xlSheet.Cells(2 + PartsRs.RecordCount + 1, 1), xlSheet.Cells(2 + PartsRs.RecordCount + 1, 8)).Columns.Interior.ColorIndex = 40
'xlApp.Range(xlSheet.Cells(2 + PartsRs.RecordCount + 1, 1), xlSheet.Cells(2 + PartsRs.RecordCount + 1, 8)).Borders.LineStyle = xlContinuous
Else
MsgBox "无信息可供您导出,请确认!", vbExclamation + vbOKOnly, "警告"
End If
End Sub
vb.net出力excel文件怎么能快一些利用vbnetVb.net表格输出的开发前台应用程序 。
vbnet对数据Vb.net表格输出的处理非常强大Vb.net表格输出 , 可以处理各种数据类型 。利用它的开发前台应用程序Vb.net表格输出,把数据的输出交给excel是一个完美的结合 。
vbnet是一种获得分子薛定谔方程近似解的处理方法 。又称电子配对法 。历史上最早发展起来的化学键理论 。主要描述分子中的共价键和共价结合Vb.net表格输出,其核心思想是电子配对形成定域化学键 。
VB.NET输出到Excel的问题一、DCOM修复
1.运行:mmc comexp.msc /32,找到我的电脑 - DCom配置中的Microsoft Excel Application

推荐阅读