Dim dt As Table = Tables("南京徳亨文生物科技有限公司设备一览表")
Dim Book As New XLS.Book '定义一个Excel工作簿
Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
Dim Style As Xls.Style = Book.NewStyle '新建一个样式
Style.ForeColor = Color.Red
style.FontBold = True '样式的背景颜色设为红色
For c As Integer = 0 To dt.Cols.Count -1 '添加列标题
Sheet(0, c).Value = dt.Cols(c).Name
Next
For c As Integer = 0 To dt.Cols.Count -1 '添加列标题
Sheet(0, c).Value = dt.Cols(c).Name
Next
For r As Integer = 0 To dt.Rows.Count - 1 '填入数据
For c As Integer = 0 To dt.Cols.Count -1
Sheet(r +1, c).Value = dt.rows(r)(c)
Next
If dt.rows(r)("内存") = 2G Then '如果折扣大于等于0.15
Sheet(r + 1,dt.Cols("内存").Index).Style = Style '设置折扣单元格的样式
End If
Next
Dim dt As Table = Tables("南京徳亨文生物科技有限公司设备一览表")
Dim Book As New XLS.Book '定义一个Excel工作簿
Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
Dim Style As Xls.Style = Book.NewStyle '新建一个样式
Style.BackColor = BackColor.Red
style.FontBold = True '样式的背景颜色设为红色
Dim st As XLS.Style = Book.NewStyle '日期列的显示格式
st.Format = "yyyy-MM-dd"
For c As Integer = 0 To nms.length -1
Sheet(0, c).Value = caps(c) '指定列标题
Sheet.Cols(c).Width = szs(c) '指定列宽
If dt.Cols(nms(c)).IsDate Then '如果是日期列
Sheet.Cols(c).Style = st '设置显示格式
End If
Next
For c As Integer = 0 To dt.Cols.Count -1 '添加列标题
Sheet(0, c).Value = dt.Cols(c).Name
Next
For r As Integer = 0 To dt.Rows.Count - 1 '填入数据
For c As Integer = 0 To dt.Cols.Count -1
Sheet(r +1, c).Value = dt.rows(r)(c)
Next
If dt.rows(r)("生产日期") = 2008,2009,2010 Then '如果折扣大于等于0.15
Sheet(r + 1,dt.Cols("生产日期").Index).Style = Style '设置折扣单元格的样式
End If
Next
Dim dt As Table = Tables("南京徳亨文生物科技有限公司设备一览表")
Dim Book As New XLS.Book '定义一个Excel工作簿
Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
Dim Style As Xls.Style = Book.NewStyle '新建一个样式
Style.BackColor = BackColor.Red
style.FontBold = True '样式的背景颜色设为红色
Dim st As XLS.Style = Book.NewStyle '日期列的显示格式
st.Format = "yyyy-MM-dd"
For c As Integer = 0 To nms.length -1
Sheet(0, c).Value = caps(c) '指定列标题
Sheet.Cols(c).Width = szs(c) '指定列宽
If dt.Cols(nms(c)).IsDate Then '如果是日期列
Sheet.Cols(c).Style = st '设置显示格式
End If
Next
For c As Integer = 0 To dt.Cols.Count -1 '添加列标题
Sheet(0, c).Value = dt.Cols(c).Name
Next
For r As Integer = 0 To dt.Rows.Count - 1 '填入数据
For c As Integer = 0 To dt.Cols.Count -1
Sheet(r +1, c).Value = dt.rows(r)(c)
Next
If dt.rows(r)("保修日期") = 没过保, 过保 Then '如果折扣大于等于0.15
Sheet(r + 1,dt.Cols("保修日期").Index).Style = Style '设置折扣单元格的样式
End If
Next
Dim dt As Table = Tables("南京徳亨文生物科技有限公司设备一览表")
Dim Book As New XLS.Book '定义一个Excel工作簿
Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
Dim Style As Xls.Style = Book.NewStyle '新建一个样式
Style.BackColor = BackColor.Plum
style.FontBold = True '样式的背景颜色设为红色
Dim st As XLS.Style = Book.NewStyle '日期列的显示格式
st.Format = "yyyy-MM-dd"
For c As Integer = 0 To nms.length -1
Sheet(0, c).Value = caps(c) '指定列标题
Sheet.Cols(c).Width = szs(c) '指定列宽
If dt.Cols(nms(c)).IsDate Then '如果是日期列
Sheet.Cols(c).Style = st '设置显示格式
End If
Next
For c As Integer = 0 To dt.Cols.Count -1 '添加列标题
Sheet(0, c).Value = dt.Cols(c).Name
Next
For r As Integer = 0 To dt.Rows.Count - 1 '填入数据
For c As Integer = 0 To dt.Cols.Count -1
Sheet(r +1, c).Value = dt.rows(r)(c)
Next
If dt.rows(r)("保修日期") = 没过保, 过保 Then '如果折扣大于等于0.15
Sheet(r + 1,dt.Cols("保修日期").Index).Style = Style '设置折扣单元格的样式
else If dt.rows(r)("保修日期") = 没过保, 过保 Then '如果折扣大于等于0.15
Sheet(r + 1,dt.Cols("保修日期").Index).Style = Style '设置折扣单元格的样式
End If
Next
Dim dt As Table = Tables("南京徳亨文生物科技有限公司设备一览表")
Dim Book As New XLS.Book '定义一个Excel工作簿
Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
Dim Style As Xls.Style = Book.NewStyle '新建一个样式
Style.BackColor = BackColor.Plum
style.FontBold = True '样式的背景颜色设为红色
Dim st As XLS.Style = Book.NewStyle '日期列的显示格式
st.Format = "yyyy-MM-dd"
For c As Integer = 0 To nms.length -1
Sheet(0, c).Value = caps(c) '指定列标题
Sheet.Cols(c).Width = szs(c) '指定列宽
If dt.Cols(nms(c)).IsDate Then '如果是日期列
Sheet.Cols(c).Style = st '设置显示格式
End If
Next
For c As Integer = 0 To dt.Cols.Count -1 '添加列标题
Sheet(0, c).Value = dt.Cols(c).Name
Next
For r As Integer = 0 To dt.Rows.Count - 1 '填入数据
For c As Integer = 0 To dt.Cols.Count -1
Sheet(r +1, c).Value = dt.rows(r)(c)
Next
If dt.rows(r)("公共设施") = 公共设施 Then '如果折扣大于等于0.15
Sheet(r + 1,dt.Cols("公共设施").Index).Style = Style '设置折扣单元格的样式
else
If dt.rows(r)("使用年限") = date.today Then
Dim d As Double = 370
msgbox(d \ 365)msgbox((d Mod 365) \ 12 + 1) End If
Next
这样写吗??