Dim hdr As Integer = tjt.HeaderRows '获得表头的层数
Dim cnt As Integer
Dim Book As New XLS.Book
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Dim Style As XLS.Style = Book.NewStyle() '定义新样式
Style.BorderTop = XLS.LineStyleEnum.Thin
Style.BorderBottom = XLS.LineStyleEnum.Thin
Style.BorderLeft = XLS.LineStyleEnum.Thin
Style.BorderRight = XLS.LineStyleEnum.Thin
Style.BorderColorTop = Color.Red
Style.BorderColorBottom = Color.Red
Style.BorderColorLeft = Color.Red
Style.BorderColorRight = Color.Red
tjt.CreateSheetHeader(Sheet) '生成表头
For c As Integer = 0 To tjt.Cols.Count - 1
' sheet(0 ,c).Style = Style
If tjt.Cols(c).Visible Then
For r As Integer = 0 To tjt.Rows.Count - 1
If tjt(r,c)<>Nothing
sheet(r + hdr,cnt).value = tjt(r,c)
End If
' sheet(r + hdr,cnt).Style = Style
Next
cnt = cnt + 1
End If
Next
Dim St2 As XLS.Style = Book.NewStyle
St2.Format = "yyyy-MM-dd"
Dim i As Integer=-1
For Each c As Col In tjt.Cols
If c.Visible
i=i+1
If c.Isdate
Sheet.Cols(i).Style = st2
End If
End If
Next
Book.Save("c:\reports\test.xls")
Dim Proc As New Process
Proc.File = "c:\reports\test.xls"
Proc.Start()
如何给导出的表test第1列公式设置为第3列+第5列+第7列
[此贴子已经被作者于2019/3/19 14:53:00编辑过]