BlackKat
BlackKat

Reputation: 420

Merge cells vertically in table detail on BIRT

Is it possible to "merge" the row vertically so that the report looks neater? Like follows:

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

In stead of:

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

I can merge by use jQuery code in report but just work in HTML of course. I cant find solution in excel, may be some trick i dont know. Or somehow i can merge cell by code after IRunTask run() in Java code. Iam using Eclipse BIRT Designer Version 4.3.2.v20140211-1400 Build <4.3.2.v20140218-1056>

Thanks for reading.

Upvotes: 5

Views: 4207

Answers (3)

Rytis Guntulis
Rytis Guntulis

Reputation: 331

I think You need to use grouping function in table.

One of tutorials is here: http://developer.actuate.com/be/documentation/ihub2-web/birtos/fg44/index.html#page/birt-os/grouping.1.16.html

Google more about it using keywords "BIRT table grouping", and also dont forget to use "Drop detail" in group header cell. In your case it would be cell containing "very long description" text.

Upvotes: 2

Michael Stahl
Michael Stahl

Reputation: 248

To do exactly what you want in your example, all you need to do is to select the cell with "very long description" and choose "Unmerge cells". This will unmerge the cells in column "Tbl Header" and will copy the contents to the top cells in the column (just under the "Tbl Hdr" cell).

But from your question is sounds like you are looking for a way to MERGE vertical cells.

The following macro will do it. Select the cells to merge, and run the macro.

The macro works on vertical set of selected cells, in one column. It will delete the contents of the cells, and put a merged version of all cells (separated by a line-feed) in the top cell.

Note the 3 lines in the macro that are commented out, towards the end. If you uncomment these, the macro will also delete the rows whose content was now merged to the top cell. This is sometimes useful.

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

Regards, Michael

Upvotes: 0

Sifu
Sifu

Reputation: 1082

For your first question :

You can merge the row vertically the same way you would do it horizontally..

Select the cells, then click merge.

Upvotes: 0

Related Questions