以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 报表打印输出横向合并单元格如何做? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=110342) |
||||
-- 作者:xxcwdlwgo -- 发布时间:2017/12/1 10:52:00 -- 报表打印输出横向合并单元格如何做? 如下图 表字段如图 如何判断,只有项目名称1有值时,项目名称2,项目名称3,项目名称4为空时,合并项目名称1,项目名称2,项目名称3,项目名称4 当只有项目名称1,项目名称2有值时,项目名称3,项目名称4为空时,合并项目名称2,项目名称3,项目名称4。 也就是当项目名称4为空时,与项目名称3合并。 依次类推。如何做?
[此贴子已经被作者于2017/12/1 10:56:28编辑过]
|
||||
-- 作者:有点甜 -- 发布时间:2017/12/1 11:17:00 -- Dim Book As New XLS.Book("d:\\abc.xls") Dim Sheet As XLS.Sheet = Book.Sheets(0) For i As Integer = 1 To sheet.Rows.count-1 Dim li As Integer = 0 Dim ri As Integer = 0 For j As Integer = 0 To 3 If sheet(i,j).text > "" Then li = j Else ri = j End If Next Sheet.MergeCell(i,li,1,ri-li+1) Next Book.Save("d:\\123.xls") Dim Proc As New Process Proc.File = "d:\\123.xls" Proc.Start() |
||||
-- 作者:lihe60 -- 发布时间:2018/3/1 20:38:00 -- 报表生成不了 [此贴子已经被作者于2018/3/1 20:39:08编辑过]
|
||||
-- 作者:lihe60 -- 发布时间:2018/3/1 20:39:00 -- 报表生成不了
[此贴子已经被作者于2018/3/1 20:39:41编辑过]
|
||||
-- 作者:有点甜 -- 发布时间:2018/3/1 22:25:00 -- Dim Book As New XLS.Book(ProjectPath & "1.xls") Dim fl As String = ProjectPath & "Reports\\123.xls" Book.Build() \'生成细节区 Dim Sheet As XLS.Sheet = Book.Sheets(0) For i As Integer = 1 To sheet.Rows.count-1 Dim li As Integer = 0 Dim ri As Integer = 0 For j As Integer = 0 To 3 If sheet(i,j).text > "" Then li = j Else ri = j End If Next Sheet.MergeCell(i,li,1,ri-li+1) Next Book.Save(fl) \'保存 Dim Proc As New Process Proc.File = fl Proc.Start() |