在BIRT的表详细信息中垂直合并单元格



是否有可能"合并"垂直行,使报告看起来更整洁?如:

+-----------+--------+--------------+
| Tbl Hdr   | Group  |    User      |
+-----------+--------+--------------+
|Very long  | [User] | [Reputation] |
|description+--------+--------------+
|of the     | [User] | [Reputation] | 
|group      +--------+--------------+
|           |        |              |
+-----------+--------+--------------+

代替:

+-----------+--------+--------------+
| Tbl Hdr   | Group  |    User      |
+-----------+--------+--------------+
|Very long  | [User] | [Reputation] |
|description|        |              |
|of the     |        |              |
|group      |        |              |
+-----------+--------+--------------+
|           | [User] | [Reputation] | 
+-----------+--------+--------------+
|           |        |              |
+-----------+--------+--------------+

我可以在报告中使用jQuery代码合并,但只是在HTML中工作。我无法在excel中找到解决方案,可能是一些我不知道的技巧。或者不知何故,我可以合并单元格后的代码IRunTask运行()在Java代码。我使用的是Eclipse BIRT Designer版本4.3.2。v20140211-1400 Build <4.2 .v20140218-1056>

我认为你需要在表中使用分组功能。

其中一个教程在这里:http://developer.actuate.com/be/documentation/ihub2-web/birtos/fg44/index.html#page/birt-os/grouping.1.16.html

用关键词"BIRT表分组"搜索更多信息,也不要忘记在组标题单元格中使用"Drop detail"。在你的例子中,它将是包含"very long description"文本的单元格。

对于你的第一个问题:

你可以垂直合并行,就像你水平合并行一样。

选择单元格,然后单击合并

要在示例中准确地执行您想要的操作,您所需要做的就是选择具有"very long description"的单元格并选择"Unmerge cells"。这将取消合并列"Tbl Header"中的单元格,并将内容复制到列的顶部单元格(就在"Tbl Hdr"单元格下方)。

但是从你的问题听起来你正在寻找一种方法来合并垂直单元格。

下面的宏将执行此操作。选择要合并的单元格,然后运行宏。

宏在一列中的选定单元格的垂直集合上工作。它将删除单元格的内容,并在顶部单元格中放置所有单元格的合并版本(以换行符分隔)。

注意宏中的3行被注释掉了,直到末尾。如果取消这些注释,宏还将删除其内容现在合并到顶部单元格的行。这有时是有用的。

Sub MergeCells()
Dim myString As String
Dim myUnion As Range
    Count = Selection.Count
    If Count > 1 Then
        myValue = Selection
        myrow = Selection.Row
        mycol = Selection.Column

        myString = ""

        For Index = 1 To Count
            If Index > 1 Then myString = myString & Chr(10) & myValue(Index, 1) Else myString = myValue(Index, 1)
        Next Index
          Selection.ClearContents
          Cells(myrow, mycol) = myString
'         For Index = 1 To Count - 1
'            Rows(myrow + 1).Delete
'         Next Index
            Cells(myrow, mycol).Select
    End If
End Sub

认为,迈克尔

最新更新