[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: dynamic table in report

Subject: Re: dynamic table in report
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 03 Aug 2011 07:17:08 -0400
Re:  dynamic table in report
At 2011-08-03 10:14 +0200, Mathis Mvrke wrote:
Hi all,

I want to display a table in a pdf-file. The problem is that the
number of rows is dynamic. Furthermore the rows form thematic
clusters. As an example:

cluster A
subcluster A.1
data 1
data 2
data 3
..
subcluster A.2
data i
data i+1
...
cluster B
subcluster B.1
data j
data j+1
..

The number of rows in each subcluster is dynamicand I want to have a
page breaks after a subcluster. That means, if a subcluster does not
fit on the currrent page, the whole subcaption-cluster should be on
the next page. It is not necessary that each cluster is on the same
page, only subcluster. I used for each row a fo:block element and set
the keep-with-previous attribute to handle it and it works.

I think you are approaching this at too low a level.


But if
there are to many rows in a subcluster, there will be a page overflow,
which makes sense. But how can I handle this? If the number of rows in
a subcluster is too big, there should be automatically a page break.

Many of my students are surprised that XSL-FO allows many <table-body> constructs within a single <table> and your use-case is an ideal situation in which to take advantage of this.

Simply put each sub-cluster into a separate
<table-body> and use
keep-together.within-column="always" on that body
segment.  No other keeps are needed.

I am using Apache FOP 0.95.

I have no idea if the example below works in FOP. It works with three other XSL-FO tools I've tested it with this morning.

I hope this helps.

. . . . . . . . . . Ken

<?xml version="1.0" encoding="US-ASCII"?><!--mathis.fo-->
<root xmlns="http://www.w3.org/1999/XSL/Format"
      font-family="Times" font-size="20pt">

  <layout-master-set>
    <simple-page-master master-name="frame"
                        page-height="297mm" page-width="210mm"
                        margin-top="15mm" margin-bottom="15mm"
                        margin-left="15mm" margin-right="15mm">
      <region-body region-name="frame-body"/>
    </simple-page-master>
  </layout-master-set>

  <page-sequence master-reference="frame">
    <flow flow-name="frame-body" xmlns="http://www.w3.org/1999/XSL/Format">
      <block>This is a test</block>
      <table>
        <table-body keep-together.within-column="always">
          <table-row><table-cell><block>Test
1</block></table-cell></table-row>
          <table-row><table-cell><block>Test
1</block></table-cell></table-row>
          <table-row><table-cell><block>Test
1</block></table-cell></table-row>
          <table-row><table-cell><block>Test
1</block></table-cell></table-row>
          <table-row><table-cell><block>Test
1</block></table-cell></table-row>
          <table-row><table-cell><block>Test
1</block></table-cell></table-row>
          <table-row><table-cell><block>Test
1</block></table-cell></table-row>
          <table-row><table-cell><block>Test
1</block></table-cell></table-row>
        </table-body>
        <table-body keep-together.within-column="always">
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
          <table-row><table-cell><block>Test
2</block></table-cell></table-row>
        </table-body>
      </table>
    </flow>
  </page-sequence>
</root>

--
Contact us for world-wide XML consulting & instructor-led training
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.