for循环输出EXCEL
--------------------编程问答-------------------- select 姓名 ||' '||ID from Table --------------------编程问答-------------------- Xlsbook = Xls.Application.Workbooks.AddXlssheet = Xlsbook.Sheets(1)
For a As Integer = 0 To 100
Xlssheet.Cells(1, a + 1) = a
Next --------------------编程问答-------------------- 我之前编写过一个输出到word表格程序,部分代码如下:
' 插入一个MemberName.CountX5的表格并填充
Dim oTable As Word.Table = oDoc.Tables.Add(oDoc.Bookmarks.Item("\endofdoc").Range, MemberName.Count + 1, 5)
oTable.Borders.OutsideLineStyle = Word.WdLineStyle.wdLineStyleSingle '设置边框
oTable.Borders.InsideLineStyle = Word.WdLineStyle.wdLineStyleSingle
oTable.Range.ParagraphFormat.SpaceAfter = 6
oTable.Columns.Item(1).Width = oWord.InchesToPoints(1.8) '改变列宽
oTable.Columns.Item(2).Width = oWord.InchesToPoints(1)
oTable.Columns.Item(3).Width = oWord.InchesToPoints(1)
oTable.Columns.Item(4).Width = oWord.InchesToPoints(1)
oTable.Columns.Item(5).Width = oWord.InchesToPoints(1)
oTable.Cell(1, 1).Range.Text = "构件名称"
oTable.Cell(1, 2).Range.Text = "强度平均值(MPa)"
oTable.Cell(1, 3).Range.Text = "强度标准差(MPa)"
oTable.Cell(1, 4).Range.Text = "强度最小值(MPa)"
oTable.Cell(1, 5).Range.Text = "强度推定值(MPa)"
For j = 0 To MemberName.Count - 1
MemberResult = CalMember(Sum, j)'调用函数
For c = 0 To 4
oTable.Cell(j + 2, c + 1).Range.Text = MemberResult(1)(0,c) Next
Next
其中MemberResult是交错数组。不知对输出到Excel是否所启发?
补充:.NET技术 , VB.NET