开发者

BIRT PDF report : fixed table heigth?

I am trying to display a table to display of products (rows) in a single A4 fixed layout page. I manage to add a table with header/detail/footer sections but I can not set a minimum height for the detail section (150mm for example). If I set a 150mm height on the detail row, then Each row will have that 150mm height. Whereas I would like, each row to have a minimal height (could be on several line if the content of some columns is wrapped).

        +---------+--------+--------------+
Tbl Hdr | col1    | col2   |   col3       |
        +---------+--------+--------------+
Tbl Dtl | [val1]  | [val2] | [val3]       |
        +---------+--------+--------------+
        |                                 |  <-should have a variable heigth
        +---------+--------+--------------+
Tbl Ftr |         |        |     Total    |
        +---------+--------+--------------+

If a set not height on the detail row then the footer comes, right beneath the detail rows, instead of sticking at the bottom of the pa开发者_C百科ge.

I hope this makes sense (if not I could provide more details). Any help would be greatly appreciated.


A BIRT report uses an auto-layout engine to optimze the content for the current context. This is designed to make the report look as good as possible regardless of the display/screen. In fact it is intended to minimize if not eliminate the verywhitespace you are trying to preserve.

One thing you could consider doing is to add a second detail row. You can then give this detail row a fixed height and have it consume the remaining whitespace. Alternatively, place a second table in the footer of the Master Page that will render the data you want and bind it to the bottom of the page. This has the advantage of adhereing tot he bottom of the page regardless of page type (letter, A4, etc...).


An alternative, when having a footer doesn't cut it:

I have a customer who wanted a fixed table size, with a fixed row height. It ended up displaying 10 rows.

In order to get around the auto formatter:

Create a variable var rowCount = 0; reportContext.setGlobalVariable("rowCount",rowCount); in the Initialize script.

In your fetch script, add rowCount++; just before return(true);. Then, change the if(!lineDataSet.fetch()) statement to the following:

if(!lineDataSet.fetch()){
    if(rowCount % 10 >0){
        row["column1"] = "";
        rowCount++;
        return(true);
    }
    return(false);
}

This can be handy in a lot of scenarios when you need to create fake data to pad out tables (e.g. missing dates)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜