决定是否在最后一页打印标题的问题:xsl-fo

发布于 2024-10-21 17:29:34 字数 976 浏览 1 评论 0原文

你好 我在使用 xsl-fo 生成 pdf 时遇到问题。 pdf 打印每页中的发票行。 所以在最后一页有一个条件检查来决定是否打印最后一页的标题。如果最后一页中有一行或多行,则应该有一个标题。否则不会。

目前是使用以下逻辑完成的

if(total number of invoice lines== preceding::number of invoice lines+1)
{
 call an empty marker
}
else
{
call a marker which prints the heading
}

,当前面的发票行数+1等于发票行总数时,将不会显示标题。当最后一页中没有更多行可显示或当最后一页中的行数大于一时,该逻辑成立。

现在的问题是,

当最后一页只有一行时,上述逻辑失败。

条件 if(发票行总数==前面的::发票行数+1) 将变为 true,并且将调用一个空标记,该标记将不显示标题。即使最后一页中只有一个发票行,我也需要显示标题。

有什么办法可以解决这个问题吗?

任何帮助表示赞赏。

-Arun

屏幕截图

以下屏幕截图显示了两页发票。

以下屏幕截图显示了带有两个发票行的最后一页。当最后一页只有两行时,逻辑成立。

http://img97.imageshack.us/i/85089628.jpg

但是当有最后一页只有一行条件检查 if(发票行总数==前面::发票行数+1) 变为 true 并且不显示标题。

http://img222.imageshack.us/i/49057497.jpg

Hi
i have a problem with pdf generation using xsl-fo. The pdf print invoice lines in each page.
So there is a conditional checking at the last page to determine whether to or not to print the heading on last page. If there is one or more lines in the last page then there should be a heading. Otherwise not.

currently it is done using the logic below

if(total number of invoice lines== preceding::number of invoice lines+1)
{
 call an empty marker
}
else
{
call a marker which prints the heading
}

when preceding number of invoice lines+1 is equal to total number of invoice lines, heading will not be displayed. The logic holds true when there is no more lines to be displayed in the last page or when the number of lines in last page is greater than one.

Now the problem is,

the above logic fails when there is only one line in the last page.

The condition if(total number of invoice lines==preceeding::number of invoice lines+1) will become true and an empty marker will be called which will not display the heading. I need to display the heading even if there is only one invoice line in the last page.

Is there any way to solve this problem?

Any help is appreciated.

-Arun

screenshots:

The following screen shots show a two page invoice.

following screen shot shows last page with two invoice lines. When there are only two lines in the last page, the logic holds.

http://img97.imageshack.us/i/85089628.jpg

But when there is only one line in the last page the conditional check
if(total number of invoice lines==preceeding::number of invoice lines+1) become true and the heading is not displayed.

http://img222.imageshack.us/i/49057497.jpg

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

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

发布评论

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

评论(1

要走干脆点 2024-10-28 17:29:34

您可以使用 OR 条件扩展 if 条件。我现在不知道确切的语法,但也许类似的东西

if(total number of invoice lines != 1 ||
   total number of invoice lines== preceding::number of invoice lines+1)
{
 call an empty marker
} ...

可能有用。

You could extends your if condition with an OR condition. I do not know the exact syntax now, but maybe something like

if(total number of invoice lines != 1 ||
   total number of invoice lines== preceding::number of invoice lines+1)
{
 call an empty marker
} ...

might work.

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