''' Dim dtb As New DataTableBuilder("Excel转置") dtb.AddDef("型号", Gettype(String),15) dtb.AddDef("规格", Gettype(String),15) dtb.AddDef("材料", Gettype(String)) dtb.AddDef("用量", Gettype(Double)) dtb.Build() MainTable= Tables("Excel转置") For i As Integer = 0 To Tables("EXCEL表").count -1 If Tables("EXCEL表").rows(i)("型号") > "" '用IsNull好些 For ii As Integer = 2 To Tables("EXCEL表").cols.count -1 Dim lm As String = Tables("EXCEL表").cols(ii).name If Tables("EXCEL表").rows(i).IsNull(lm) = False Tables("EXCEL转置").addnew Dim r As Row = Tables("EXCEL转置").current r("型号") = Tables("EXCEL表").rows(i)("型号") r("规格") = Tables("EXCEL表").rows(i)("规格") r("材料") = lm r("用量") = Tables("EXCEL表").rows(i)(lm) End If Next End If Next
|