C#.net如何用html生成Excel的表格,再对其进行 *** 作

C#.net如何用html生成Excel的表格,再对其进行 *** 作,第1张

net向EXCEL写入数据的示例程序http://hibaiducom/jonesvale/blog/item/3134ff1ecebdfc64f724e44bhtml
Private Sub WriteExcel()
Dim xlApp As ExcelApplication
Dim xlBook As ExcelWorkbook
Dim xlSheet As ExcelWorksheet
Dim nn As Integer = 0
Irowcount = objDataSetTables("DataAnalyseVIEW")RowsCount
Icolcount = objDataSetTables("DataAnalyseVIEW")ColumnsCount
Try
xlApp = CreateObject("ExcelApplication")
xlBook = xlAppWorkbooksAdd
xlSheet = xlBookWorksheets(1)
xlSheetName = "DataAnalyse"
xlSheetCells(1, 1)Value = objDataSetTables("DataAnalyseVIEW")Columns(2)ColumnName()ToString()
xlSheetCells(1, 2)Value = objDataSetTables("SerialNumberTable")Rows(txtN)("SerialNumber")ToString()
xlSheetCells(2, 1)Value = objDataSetTables("DataAnalyseVIEW")Columns(3)ColumnName()ToString()
xlSheetCells(2, 2)Value = objDataSetTables("DataAnalyseVIEW")Rows(0)("Client")ToString()
xlSheetCells(3, 1)Value = objDataSetTables("DataAnalyseVIEW")Columns(5)ColumnName()ToString()
xlSheetCells(3, 2)Value = objDataSetTables("DataAnalyseVIEW")Rows(0)("Productor")ToString()
xlSheetCells(4, 1)Value = objDataSetTables("DataAnalyseVIEW")Columns(6)ColumnName()ToString()
xlSheetCells(4, 2)Value = objDataSetTables("DataAnalyseVIEW")Rows(0)("Model")ToString()
xlSheetCells(5, 1)Value = objDataSetTables("DataAnalyseVIEW")Columns(4)ColumnName()ToString()
xlSheetCells(5, 2)Value = objDataSetTables("DataAnalyseVIEW")Rows(0)("StationName")ToString()
xlSheetCells(6, 1)Value = objDataSetTables("DataAnalyseVIEW")Columns(7)ColumnName()ToString()
xlSheetCells(6, 2)Value = objDataSetTables("DataAnalyseVIEW")Rows(0)("DataTime")ToString()
xlSheetCells(7, 1)Value = objDataSetTables("DataAnalyseVIEW")Columns(8)ColumnName()ToString()
xlSheetCells(7, 2)Value = objDataSetTables("DataAnalyseVIEW")Rows(0)("status")ToString()
xlSheetCells(8, 1)Value = "Result Begin"
Progressbar1Step = 1
Progressbar1Value = 1
Progressbar1Visible = True
For i = 0 To Icolcount - 1
If i < 2 Or i > 7 Then
nn = nn + 1
xlSheetCells(9, nn)Value = objDataSetTables("DataAnalyseVIEW")Columns(i)ColumnName()ToString
End If
Next
For Irow = 0 To Irowcount - 1
Progress(Irowcount - 1)
nn = 0
For Icol = 0 To Icolcount - 1
If Icol < 2 Or Icol > 7 Then
nn = nn + 1
xlSheetCells(Irow + 10, nn)Value = objDataSetTables("DataAnalyseVIEW")Rows(Irow)(Icol)ToString()
End If
Next
Next
xlSheetCells(Irow + 10, 1)Value = "Result End "
xlBookSaveAs(strFName)
xlSheet = Nothing '释放资源
xlBookClose() '关闭工作簿
xlBook = Nothing '释放资源
xlAppQuit() '退出excel应用程序
xlApp = Nothing
Catch ex As Exception
MsgBox(exMessage)
End Try
End Sub
批量数据处理方法:
http://hibaiducom/jonesvale/blog/item/ef4d8a95d7a45d16d21b7085html

以上就是关于C#.net如何用html生成Excel的表格,再对其进行 *** 作全部的内容,包括:C#.net如何用html生成Excel的表格,再对其进行 *** 作、、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/10199645.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-06
下一篇 2023-05-06

发表评论

登录后才能评论

评论列表(0条)

保存