如何在XSL-FO的表格中汇总每页的某些值? [英] How can I sum up some values per page in a table in XSL-FO?

查看:120
本文介绍了如何在XSL-FO的表格中汇总每页的某些值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用XSL-FO生成打印出的帐户对帐单. PDF实际上只是一个简单的表,每个页面上都有一个简单的标题.困难在于我必须显示每页的交易量,例如

I'm using XSL-FO to generate an account statement print out. The PDF is actually just a simple table with a simple header on every page. The difficulty is that I have to display transaction volumes per page, e.g.

+------------------------------+-----------+-----------+---------------------+
| Text                         | Credit    | Debit     | Balance             |
+------------------------------+-----------+-----------+---------------------+
| Previous month               |           |           |           (*1) 1000 |
| abc                          |      1000 |           |                2000 |
| abc                          |           |       500 |                1500 |
| abc                          |           |       200 |                1300 |
| ...                          |           |           |                     |
| Carry over                   | (*2) 1000 |  (*3) 700 |           (*4) 1300 |
+------------------------------+-----------+-----------+---------------------+

第2页

+------------------------------+-----------+-----------+---------------------+
| Text                         | Credit    | Debit     | Balance             |
+------------------------------+-----------+-----------+---------------------+
| Previous page                | (*2) 1000 |  (*3) 700 |           (*4) 1300 |
| abc                          |      1000 |           |                2300 |
| abc                          |           |       500 |                1800 |
| abc                          |           |       200 |                1600 |
| ...                          |           |           |                     |
| Carry over                   | (*2) 2000 | (*3) 1400 |           (*4) 1600 |
+------------------------------+-----------+-----------+---------------------+

以下是一些解释:

  1. 这是上个月的余额.它是预先计算的,众所周知是XSL变量.没问题,那是一个常规标题(仅在第一页上)
  2. 该值是按每页计算的.它汇总了同一页面上的所有贷方金额.我自己无法计算,因为我不知道XSL-FO何时进行分页.所以我想XSL-FO必须为我做计算.页面底部的总和与下一页顶部的总和相同.
  3. 此值与2相同,仅适用于借方金额.
  4. 此值只是页面底部的最后一笔交易的余额.该值将在下一页的顶部重复.

如何使用XSL-FO进行这些计算?

How can I do these calculations with XSL-FO?

另请参阅以下相关问题:

See also this related question: How to display one or the other information depending on the page number in XSL-FO?

推荐答案

不幸的是,根据我的发现,fop并未实现<fo:retrieve-table-marker/>.相反,这里的解决方案对我有用:

Unfortunately, fop doesn't implement <fo:retrieve-table-marker/> from what I have found out. Instead, this solution here worked for me:

这涉及在<fo:flow/>之外创建一个单独的表,该表使用<fo:retrieve-marker/>元素显示表头.

It involves creating a separate table outside of the <fo:flow/> that displays the table header using <fo:retrieve-marker/> elements.

这篇关于如何在XSL-FO的表格中汇总每页的某些值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆