以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]导出多个分组小计丢失 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=152559) |
-- 作者:miaoqingqing -- 发布时间:2020/7/15 10:13:00 -- [求助]导出多个分组小计丢失 此主题相关图片如下:导出丢失分组统计 小计.jpg Dim tt As Table = Tables("深化成果") \'Dim tt As Table = Tables("主窗口_Table3") Dim file As String = "d:\\深化成果.xls" Dim flg As New SaveExcelFlags flg.CellStyle = True tt.SaveExcel(file ,tt.name,flg) Dim hdr As Integer = tt.HeaderRows \'获得表头的层数 Dim cnt As Integer Dim Book As New XLS.Book(file) Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim Style As XLS.Style = Book.NewStyle() \'定义新样式 Style.ForeColor = Color.Crimson \'设置样式的字体颜色 \'Style.ForeColor = Color.Blue \'设置样式的字体颜色 Style.FontBold = True \'Style.BackColor = Color.Cyan \'Style.BackColor = Color.LightCyan Style.BackColor = Color.LightGray Style.BorderTop = XLS.LineStyleEnum.None Style.BorderBottom = XLS.LineStyleEnum.None Style.BorderLeft = XLS.LineStyleEnum.None Style.BorderRight = XLS.LineStyleEnum.None style.AlignVert = XLS.AlignVertEnum.Center For c As Integer = 0 To tt.Cols.Count - 1 If tt.Cols(c).Visible Then If tt.Cols(c).IsDate Then Sheet.Cols(cnt).Style = Style ElseIf tt.Cols(c).IsBoolean Then For r As Integer = 0 To tt.Rows.Count - 1 If tt.Rows(r).IsNull(c) = False sheet(r + hdr,cnt).value = IIF(tt(r,c),"√","") End If Next cnt = cnt + 1 Continue For End If For r As Integer = 0 To tt.Rows.Count - 1 If tt.Rows(r).IsNull(c) = False sheet(r + hdr,cnt).value = tt(r,c) End If Next cnt = cnt + 1 End If Next For n As Integer = 0 To Sheet.Rows.Count -1 \'\'导出逻辑列 打钩 \'If Sheet(n,6).Value = "1" Then \'Sheet(n,6).Value = "√" \'Else \'Sheet(n,6).Value = "" \'End If \'\'导出逻辑列 打钩 If Sheet(n,0).Value.contains("_") Then If n > 2 Then For c As Integer = 0 To 39 Sheet (n,c).Style = Style Next End If Else For c As Integer = 0 To 39 try \'If Sheet(n,c).Style.BackColor.G <> 255 Then If Sheet(n,c).St 导出要保留单元格颜色绘制 |
-- 作者:有点蓝 -- 发布时间:2020/7/15 10:20:00 -- 不支持导出汇总数据的,要自己手工添加合计。或者设计模板导出:http://www.foxtable.com/webhelp/topics/2877.htm |