Dim dr As Row = CurrentTable.Current If dr Is Nothing Then Return End If Dim fl As String = ProjectPath & "Attachments\\标签模板.xls" Dim Book As New XLS.Book(fl) \'根据当前行的几个可能为空值得列是否为空值调整模板的相关行列的高与宽. Dim sheet = Book.sheets(0)
Dim v,m,n As Single Dim lst As List(Of Integer) If dr.IsNull("材质2") Then m = m + 1 lst.add(7) End If If dr.IsNull("材质3") Then m = m + 1 lst.add(8) End If If dr.IsNull("材质4") Then m = m + 1 lst.add(9) End If If dr.IsNull("B1") Then n = n + 1 lst.add(18) End If v = 9 * m + 22 * n v = v/(sheet.Rows.count - 2 - m - n) v = 9 + v v = Format(v,"0.00") MessageBox.Show(v)
For i As Integer = 2 To sheet.Rows.count -1 If lst.Contains(i) Then sheet.Rows(i).height = 0
End If sheet.Rows(i).height = v Next book.Save(fl)