以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 如何给导出的表设置公式 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=132305) |
-- 作者:lihe60 -- 发布时间:2019/3/19 14:53:00 -- 如何给导出的表设置公式 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编辑过]
|
-- 作者:有点甜 -- 发布时间:2019/3/19 15:05:00 -- 参考
http://www.foxtable.com/webhelp/scr/1160.htm
|
-- 作者:lihe60 -- 发布时间:2019/3/19 15:11:00 -- Sheet(1,0).Formula = "=1+3" 意思是,B也可能是D,事先不确定是哪列的。 A1=B1+C1 A2=B2+C2 |
-- 作者:有点甜 -- 发布时间:2019/3/19 15:57:00 --
那规则是什么,要把哪些列相加?举例说明
|
-- 作者:wh420 -- 发布时间:2020/8/5 10:41:00 -- 此主题相关图片如下:1.jpg 服务费=A列数值*5.52%,其他行自动填充。A2*5.52%,A3*5.52%.......
|