Dim Book As new XLS.Book
Dim Sht As XLS.Sheet = Book.Sheets(0)
Dim r As Long = 0
Sht(r,0).Value = "品类"
Sht(r,1).Value = "固定字段"
Sht(r,2).Value = "编码"
For Each Dr As DataRow In DataTables("表A").DataRows
If Not Dr.IsNull("品类") Then
For i As Integer = 1 To Dr("数量")
R + = 1
Sht(r,0).Value = Dr("品类")
Sht(r,1).Value = Dr("固定字段")
Sht(r,2).Value = Dr("品类") & Dr("固定字段") & Format(i,"000")
Next
End If
R + = 1
Next
Dim Style As xls.style = book.NewStyle
Style.FontBold = True
Sht.Rows(0).Style = Style
Book.Save("d:\test.xls")
Dim proc As new Process
proc.File = "d:\test.xls"
proc.Start
[此贴子已经被作者于2012-8-27 14:40:19编辑过]