BIRT PDF 报告:固定表格高度?

发布于 2024-08-31 04:47:19 字数 733 浏览 3 评论 0原文

我正在尝试显示一个表格,以在单个 A4 固定布局页面中显示产品(行)。 我设法添加一个带有页眉/详细信息/页脚部分的表格,但我无法设置详细信息部分的最小高度(例如 150 毫米)。 如果我在详细信息行上设置 150 毫米的高度,那么每行都将具有 150 毫米的高度。 然而我希望每行都有一个最小高度(如果某些列的内容被包装,则可以在几行上)。

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

如果未在详细信息行上设置高度,则页脚将位于详细信息行的正下方,而不是粘贴在页面底部。

我希望这是有道理的(如果没有,我可以提供更多细节)。 任何帮助将不胜感激。

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 page.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酒绊 2024-09-07 04:47:19

BIRT 报告使用自动布局引擎来优化当前上下文的内容。这样做的目的是使报告看起来尽可能好,无论显示/屏幕如何。事实上,它的目的是最小化(如果不是消除)您试图保留的空白。

您可以考虑做的一件事是添加第二个详细信息行。然后,您可以为该详细信息行指定固定高度并让它占用剩余的空白。或者,在母版页的页脚中放置第二个表,该表将呈现所需的数据并将其绑定到页面底部。这样做的优点是无论页面类型如何(letter、A4 等),都可以粘附到页面底部。

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...).

孤星 2024-09-07 04:47:19

另一种选择是,当页脚无法解决问题时:

我有一位客户想要固定的表格尺寸和固定的行高。最终显示 10 行。

为了绕过自动格式化程序:

创建一个变量 var rowCount = 0;
reportContext.setGlobalVariable("rowCount",rowCount);

初始化脚本中。

在提取脚本中,在 return(true); 之前添加 rowCount++;
然后,将 if(!lineDataSet.fetch()) 语句更改为以下内容:

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

当您需要创建假数据来填充表(例如缺少日期)时,这在很多情况下都很方便

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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文