Dim tt As Table = Tables("室内设计项目")
Dim file As String = "d:\我的项目.xls"
Dim flg As New SaveExcelFlags
flg.CellStyle = True
For Each c As Col In tt.Cols
c.TextAlign = TextAlignEnum.Center
Next
tt.SaveExcel(file ,tt.name,flg)
Dim Book As New XLS.Book(file)
Dim Sheet1 As XLS.Sheet = Book.Sheets(0)
Dim Style As XLS.Style = Book.NewStyle() '定义新样式
Style.ForeColor = Color.Red '设置样式的字体颜色
Style.FontBold = True
Style.BackColor = Color.DodgerBlue
Style.BorderTop = XLS.LineStyleEnum.None
Style.BorderBottom = XLS.LineStyleEnum.None
Style.BorderLeft = XLS.LineStyleEnum.None
Style.BorderRight = XLS.LineStyleEnum.None
Dim Style2 As XLS.Style = Book.NewStyle() '定义新样式
Style2.BorderTop = XLS.LineStyleEnum.Thin
Style2.BorderBottom = XLS.LineStyleEnum.Thin
Style2.BorderLeft = XLS.LineStyleEnum.Thin
Style2.BorderRight = XLS.LineStyleEnum.Thin
Style2.BorderColorTop = Color.red
Style2.BorderColorBottom = Color.red
Style2.BorderColorLeft = Color.red
Style2.BorderColorRight = Color.red
For n As Integer = 1 To Sheet1.Rows.Count -1
If Sheet1(n,6).Value = "1" Then
Sheet1(n,6).Value = "√"
Else
Sheet1(n,6).Value = ""
End If
If Sheet1(n,1).Value.contains("地址") Then
If n > 2 Then
For c As Integer = 0 To 9
Sheet1 (n,c).Style = Style
Next
End If
Else
For c As Integer = 0 To 9
'Sheet1 (n,c).Style = Style2
Next
'Sheet1(n,0).Style = Style2
End If
Next
Book.Save(file)
Dim Proc As New Process
Proc.File = file
Proc.Start()