biz-StreamマニュアルXMLページレイアウトタグ リファレンス第9章 繰り返し制御9.4 縦方向表<fo:table>

9.4 縦方向表<fo:table>


9.4.1機能説明

表の定義を行います。表は、ヘッダ行・明細行・フッタ行のセルごとに定義することができます。
縦方向表では、データの増減により行数が可変となります。



9.4.2属性説明

1fo:table属性説明

表全体についての定義を行います。

属性名指定説明指定内容初期値
name任意名前CDATA
x任意X座標CDATA0
y任意Y座標CDATA0
unit任意単位(Choice)mm / cm / in / px / ptmm
master-reference任意<bs:datasource-master>との関連付けCDATA
border-width任意枠線の幅CDATA0.1
border-color任意枠線の色CDATA
border-style任意Y軸目盛り線のスタイル(Choice)「6.2 線<Line>」にある属性説明の「LineStyle属性」を参照Solid
background-color任意背景の色CDATA
font-family任意フォント種類(Choice)ライブラリ共通ガイド
6.2 横書きフォント』を参照
MSGothic
font-color任意フォントの色CDATA0
font-size任意フォントサイズCDATA8
font-style任意フォントスタイル(Choice)PLAIN /
BOLD /
ITALIC /
BOLD-ITALIC
PLAIN
font-encoding 任意 フォントエンコーディング (Choice) 90ms-RKSJ-H / 90ms-RKSJ-V / 90msp-RKSJ-H / 90msp-RKSJ-V / UniJIS-UTF16-H / UniJIS-UTF16-V フォントごとのデフォルト値
max-rows任意行の繰返し回数CDATA10
number-tables-repeated任意表の繰り返し回数CDATA
no-data-disabled任意データが0件の場合、表を表示しない(Choice)true(表示しない) /
false(表示する)
false
fix任意max-rowsで指定した行数分だけ固定で明細を表示(Choice)true(固定)する /
false(固定しない)
false
  • (注)初期値:出荷時のXMLデフォルト情報(default_values.properties)値を表します。ユーザにより値の変更が行われた場合は内容が異なります。

2fo:table-column属性説明

1行におけるセル数および、各セルの幅と余白について定義します。
なお、table-columnで定義したセル数は表全体に反映されるため、行毎に異なるセル数を定義することはできません。table-body内で定義するセル数(table-cell要素数)と一致しない場合は、エラーとなります。

属性名指定説明指定内容初期値
name任意名前CDATA
column-width必須セルの幅CDATA
margin任意領域内の余白(Choice)start:左端余白 /
end:右端余白 /
top:上部余白 /
bottom:下部余白
1pt
1pt
0pt
2pt

3fo:table-header属性説明

表のヘッダ行に関する定義を行います。
行の高さの定義を行わない場合、実サイズが高さとして採用されます。

属性名指定説明指定内容初期値
name任意名前CDATA
master-reference任意<bs:datasource-master>との関連付けCDATA
border-width任意枠線の幅CDATA0.1
border-color任意枠線の色CDATA
border-style任意枠線のスタイル(Choice)「6.2 線<Line>」にある属性説明の「LineStyle属性」を参照Solid
background-color任意背景の色CDATA

4fo:table-body属性説明

表の明細行に関する定義を行います。

属性名指定説明指定内容初期値
name任意名前CDATA
master-reference任意<bs:datasource-master>との関連付けCDATA
border-width任意枠線の幅CDATA0.1
border-color任意枠線の色CDATA
border-style任意枠線のスタイル(Choice)「6.2 線<Line>」にある属性説明の「LineStyle属性」を参照Solid
background-color任意背景の色CDATA

5fo:table-row属性説明

表の行に関する定義を行います。
行の高さの定義を行わない場合、実サイズが高さとして採用されます。

属性名指定説明指定内容初期値
name任意名前CDATA
row-type任意行の種別(Choice)details:明細行 /
subtotal:小計行 /
total:合計行
details
line-height任意行の高さCDATA
border-width任意枠線の幅CDATA0.1
border-color任意枠線の色CDATA
border-style任意枠線のスタイル(Choice)「6.2 線<Line>」にある属性説明の「LineStyle属性」を参照Solid
background-color任意背景の色CDATA
view任意合計行の表示方法(Choice)next:制御なし /
last:最終ページが合計行だけになる場合、前ページに表示する
next

6fo:table-footer属性説明

表のフッタ行に関する定義を行います。
行の高さの定義を行わない場合、実サイズが高さとして採用されます。

属性名指定説明指定内容初期値
name任意名前CDATA
master-reference任意<bs:datasource-master>との関連付けCDATA
border-width任意枠線の幅CDATA0.1
border-color任意枠線の色CDATA
border-style任意枠線のスタイル(Choice)「6.2 線<Line>」にある属性説明の「LineStyle属性」を参照Solid
background-color任意背景の色CDATA

7fo:table-cell属性説明

各行におけるセルの定義を行います。

属性名指定説明指定内容初期値
name任意名前CDATA
border-width任意枠線の幅CDATA0.1
border-color任意枠線の色CDATA
border-style任意枠線のスタイル(Choice)「6.2 線<Line>」にある属性説明の「LineStyle属性」を参照Solid
background-color任意背景の色CDATA
align任意複数要素の整列方向(Choice)horizon /
vertical /
none
horizon
text-align任意配置(水平方向)(Choice)left /
center /
right
left
cell-align任意配置(垂直方向)(Choice)top /
center /
bottom
bottom

  • ※1Narrow属性は存在しませんが、レイアウト・デザイナのプロパティウィンドウに表示されます


9.4.3記述例

fo:tableサンプル1

fo:tableサンプル1(『<biz-Stream_home>/sample/xml/table/tableSample1.xml』)

<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Name="tableSample1" Width="140" Height="80" X="10" Y="10" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:bs="http://www.brainsellers.com/schema" xmlns:svg="http://www.brainsellers.com/schema" xmlns:form="http://www.brainsellers.com/schema" xmlns:pdf="http://www.brainsellers.com/schema" version="5.0.0">
    <!-- table1 -->

    <fo:table x="0" y="37.113" font-family="MSGothic" font-style="PLAIN" max-rows="10" border-width="0.1" border-color="0,0,0" no-data-disabled="false" fix="false">
        <!-- カラム定義 -->

        <fo:table-column column-width="7"/>

        <fo:table-column column-width="70"/>

        <fo:table-column column-width="40"/>

        <!-- (1)ヘッダー -->

        <fo:table-header>
            <fo:table-row line-height="5">
                <fo:table-cell align="horizon" text-align="center" cell-align="center" narrow="size" background-color="0,0,128">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontColor="255,255,255" FontStyle="PLAIN" Narrow="horizon">SEQ.</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="center" cell-align="center" narrow="size" background-color="0,0,128">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontColor="255,255,255" FontStyle="PLAIN" Narrow="horizon">会社名</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="center" cell-align="center" narrow="size" background-color="0,0,128">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontColor="255,255,255" FontStyle="PLAIN" Narrow="horizon">氏名</Label>
                </fo:table-cell>
            </fo:table-row>
        </fo:table-header>
        <!-- (2)明細 -->

        <fo:table-body>
            <!-- 明細1行目 -->

            <fo:table-row line-height="10">
                <fo:table-cell align="horizon" text-align="center" cell-align="center" narrow="size">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">1</Label>
                </fo:table-cell>
                <fo:table-cell align="vertical" text-align="center" cell-align="center" narrow="size">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">ブレインセラーズ・ドットコム株式会社</Label>
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">BrainSellers.com Corporation</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="center" cell-align="center" narrow="size">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">山田 花子</Label>
                </fo:table-cell>
            </fo:table-row>
            <!-- 明細2行目 -->

            <fo:table-row line-height="10">
                <fo:table-cell align="horizon" text-align="center" cell-align="center" narrow="size">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">2</Label>
                </fo:table-cell>
                <fo:table-cell align="vertical" text-align="center" cell-align="center" narrow="size">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">ブレインセラーズ・ドットコム株式会社</Label>
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">BrainSellers.com Corporation</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="center" cell-align="center" narrow="size">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">加藤 三郎</Label>
                </fo:table-cell>
            </fo:table-row>
            <!-- 明細3行目 -->

            <fo:table-row line-height="10">
                <fo:table-cell align="horizon" text-align="center" cell-align="center" narrow="size">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">3</Label>
                </fo:table-cell>
                <fo:table-cell align="vertical" text-align="center" cell-align="center" narrow="size">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">株式会社鈴木商店</Label>
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">SUZUKI STORE K.K.</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="center" cell-align="center" narrow="size">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">鈴木 太郎</Label>
                </fo:table-cell>
            </fo:table-row>
        </fo:table-body>
        <!-- (3)フッター -->

        <fo:table-footer>
            <fo:table-row line-height="5">
                <fo:table-cell align="horizon" text-align="center" cell-align="center" narrow="size" background-color="204,204,204">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">合計</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="center" cell-align="center" narrow="size" background-color="204,204,204">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">2社</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="center" cell-align="center" narrow="size" background-color="204,204,204">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">3名</Label>
                </fo:table-cell>
            </fo:table-row>
        </fo:table-footer>
    </fo:table>
</Layout>


生成されるPDF(『<biz-Stream_home>/sample/xml/table/tableSample1.pdf』)


fo:tableサンプル1
  • 1行におけるセル数とセル幅の定義を行います。
    a)column-width="7"
    b)column-width="70"
    c)column-width="40"
    ※ セル数・セル幅の定義は表全体に反映されるため、行ごとにセル数を変更することはできません。
  • 各行の詳細定義を行います。
    a)ヘッダ行(table-header)   line-height="5"
    b)明細行:1行目(table-row)  line-height="10"
    b')明細行:2行目(table-row)  line-height="10"
    b')明細行:3行目(table-row)  line-height="10"
    c)フッタ行(table-footer)    line-height="5"
    ※ 各行(table-header,table-row,table-footer)で行の高さ(line-height属性)が指定されない場合、実サイズが行の高さとして採用されます。
  • 各セルの詳細定義を行います。
    ※ セル(table-cell)に複数の子要素を指定する場合、align属性で整列方法を選択することができます。


tableサンプル2

各行および、各行のセルごとで詳細な定義を行う場合のサンプルです。

tableサンプル2(『<biz-Stream_home>/sample/xml/table/tableSample2.xml』)

<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Name="tableSample1" Width="100" Height="70" X="10" Y="10" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:bs="http://www.brainsellers.com/schema" xmlns:svg="http://www.brainsellers.com/schema" xmlns:form="http://www.brainsellers.com/schema" xmlns:pdf="http://www.brainsellers.com/schema" version="5.0.0">
    <!-- table1 -->

    <fo:table y="20" font-family="MSGothic" font-style="PLAIN" max-rows="10" no-data-disabled="false" fix="false">
        <!-- テーブルカラム定義 -->

        <fo:table-column column-width="20"/>

        <fo:table-column column-width="20" margin="start:1;end:1;top:1;bottom:1"/>

        <fo:table-column column-width="20" margin="start:3;end:3;top:0;bottom:0"/>

        <fo:table-column column-width="20" margin="start:0;end:0;top:3;bottom:3"/>

        <!-- (1)ヘッダー -->

        <fo:table-header border-width="1" border-color="255,0,0">
            <fo:table-row line-height="5">
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size" background-color="153,153,153">
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size" border-color="0,0,0">
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size" border-width="0.1">
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="top" narrow="size">
                </fo:table-cell>
            </fo:table-row>
        </fo:table-header>
        <!-- (2)明細 -->

        <fo:table-body>
            <!-- 明細1行目 -->

            <fo:table-row line-height="10" border-color="0,0,0" background-color="0,255,0">
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">明細1</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">明細2</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">明細3</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="top" narrow="size">
                    <Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">明細4</Label>
                </fo:table-cell>
            </fo:table-row>
        </fo:table-body>
        <!-- (3)フッター -->

        <fo:table-footer>
            <fo:table-row line-height="10">
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size" border-color="0,0,0">
                </fo:table-cell>
            </fo:table-row>
        </fo:table-footer>
    </fo:table>
</Layout>


生成されるPDF(『<biz-Stream_home>/sample/xml/table/tableSample2.pdf』)


fo:tableサンプル2
  • テーブルカラム定義
    • セル1:column-width="20"
    • セル2:column-width="20"、margin="start:1;end:1;top:1;bottom:1"
    • セル3:column-width="20"、margin="start:3;end:3"
    • セル4:column-width="20"、margin="top:3;bottom:3"
  • ヘッダ行:line-height="5"、border-color="255,0,0"、border-width="1"
    • セル1:column-width="20"
    • セル2:column-width="20"、margin="start:1;end:1;top:1;bottom:1"
    • セル3:column-width="20"、margin="start:3;end:3"
    • セル4:column-width="20"、margin="top:3;bottom:3"
  • 明細行:line-height="10"、border-color="0"、background-color="0,255,0"
    • セル1:
    • セル2:
    • セル3:
    • セル4:cell-align="top"
  • フッタ行:line-height="10"
    • セル1:
    • セル2:
    • セル3:
    • セル4:border-color="0"


tableサンプル3

ドキュメントレイアウトとページレイアウトを組み合わせて、データソースから取得したデータを元に行数が可変となるケースのサンプルです。
データベースにはDB2のSAMPLEデータベースを使用しています。

ドキュメントレイアウトのサンプル(『<biz-Stream_home>/sample/xml/table/tableSample3-doc.xml』)

<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:pdf="http://www.brainsellers.com/schema" xmlns:svg="http://www.brainsellers.com/schema" xmlns:bs="http://www.brainsellers.com/schema" xmlns:form="http://www.brainsellers.com/schema" version="5.0.0">
    <bs:datasource-master-set>
        <bs:datasource-master master-name="SALES-DATA" position="inherit">
            <bs:query-master-reference master-reference="SALES"/>

        </bs:datasource-master>
        <bs:database-resource-master master-name="DB2" driver="com.ibm.db2.jcc.DB2Driver" url="jdbc:db2://brain_db:50000/SAMPLE" userid="administrator" password="ZGIyYWRtaW4= "/>

        <bs:query-master master-name="SALES">
            <bs:query-statement master-reference="DB2">select SALES.SALES_DATE,SALES.SALES_PERSON,SALES.REGION,SALES.SALES from SALES where (SALES.SALES = 7) </bs:query-statement>
            <bs:data-type column-name="SALES_DATE" type="date"/>
            <bs:data-type column-name="SALES_PERSON" type="varchar"/>
            <bs:data-type column-name="REGION" type="varchar"/>
            <bs:data-type column-name="SALES" type="integer"/>
            <!-- TableName = SALES	 AliasTableName = SALES	 FieldName = SALES_DATE	 TOTAL = 	 SORT = 	 ExtractionCnditions = 	 orStr = 	 type = date
 TableName = SALES	 AliasTableName = SALES	 FieldName = SALES_PERSON	 TOTAL = 	 SORT = 	 ExtractionCnditions = 	 orStr = 	 type = varchar
 TableName = SALES	 AliasTableName = SALES	 FieldName = REGION	 TOTAL = 	 SORT = 	 ExtractionCnditions = 	 orStr = 	 type = varchar
 TableName = SALES	 AliasTableName = SALES	 FieldName = SALES	 TOTAL = 	 SORT = 	 ExtractionCnditions = 7	 orStr = 	 type = integer
-->

        </bs:query-master>
    </bs:datasource-master-set>
    <fo:layout-master-set>
        <fo:simple-page-master master-name="A4V" page-height="297mm" page-width="210mm">
            <fo:region-body/>
        </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="A4V" bs:local-page-control="none">
        <fo:flow flow-name="xsl-region-body">
            <bs:block-container>
                <bs:include href="${base-dir}/sample/xml/table/tableSample3-page.xml"/>

            </bs:block-container>
        </fo:flow>
    </fo:page-sequence>
</fo:root>


ページレイアウトのサンプル(『<biz-Stream_home>/sample/xml/table/tableSample3-page.xml』)

<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Width="210mm" Height="297mm" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:bs="http://www.brainsellers.com/schema" xmlns:svg="http://www.brainsellers.com/schema" xmlns:form="http://www.brainsellers.com/schema" xmlns:pdf="http://www.brainsellers.com/schema" version="5.0.0">
    <fo:table x="27.817" y="260.211" font-family="MSGothic" font-style="PLAIN" max-rows="10" no-data-disabled="false" fix="false">
        <fo:table-column column-width="37.588"/>

        <fo:table-column column-width="37.588"/>

        <fo:table-column column-width="37.588"/>

        <fo:table-column column-width="37.588"/>

        <fo:table-header>
            <fo:table-row line-height="8.451" border-width="0.1" border-color="0,0,0" background-color="192,192,192">
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Label Width="37.588" Height="8.451" Horizon="center" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">SALES_DATE</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Label Width="37.588" Height="8.451" Horizon="center" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">SALES_PERSON</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Label Width="37.588" Height="8.451" Horizon="center" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">REGION</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Label Width="37.588" Height="8.451" Horizon="center" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">SALES</Label>
                </fo:table-cell>
            </fo:table-row>
        </fo:table-header>
        <fo:table-body master-reference="SALES-DATA">
            <fo:table-row line-height="8.451" border-width="0.1" border-color="0,0,0">
                <fo:table-cell name="SALES_DATE" align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Label Name="SALES_DATE" Width="37.588" Height="8.451" Horizon="center" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="10" FontStyle="PLAIN" Narrow="horizon"/>
                </fo:table-cell>
                <fo:table-cell name="SALES_PERSON" align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Label Name="SALES_PERSON" Width="37.588" Height="8.451" Horizon="center" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="10" FontStyle="PLAIN" Narrow="horizon"/>
                </fo:table-cell>
                <fo:table-cell name="REGION" align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Label Name="REGION" Width="37.588" Height="8.451" Horizon="center" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="10" FontStyle="PLAIN" Narrow="horizon"/>
                </fo:table-cell>
                <fo:table-cell name="SALES" align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Label Name="SALES" Width="37.588" Height="8.451" Horizon="center" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="10" FontStyle="PLAIN" Narrow="horizon"/>
                </fo:table-cell>
            </fo:table-row>
        </fo:table-body>
    </fo:table>
</Layout>


生成されるPDF(『<biz-Stream_home>/sample/xml/table/tableSample3.pdf』)

fo:tableサンプル3

fo:table-row が5行繰り返されます。

ページレイアウトではfo:table-bodyのmaster-reference属性でドキュメントレイアウトを定義したデータソースに関連付けをします。
明細行(fo:table-row)を1行分定義し、fo:table-bodyで定義したデータソースから取得した実際のデータ内容に従って行数が自動的に変動します。
※ データにはDB2のSAMPLEデータベースを使用しています。



tableサンプル4

1つのデータソースをページレイアウト内の複数のfo:tableで参照するサンプルです。
データベースにはDB2のSAMPLEデータベースを使用しています。
STAFFテーブルから入社7年目の人を検索し、氏名と給与を表示します。検索結果は6件です。


ドキュメントレイアウトのサンプル(『<biz-Stream_home>/sample/xml/table/tableSample4-doc.xml』)


<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:pdf="http://www.brainsellers.com/schema" xmlns:svg="http://www.brainsellers.com/schema" xmlns:bs="http://www.brainsellers.com/schema" xmlns:form="http://www.brainsellers.com/schema" version="5.0.0">
    <bs:datasource-master-set>
        <bs:datasource-master master-name="STAFF-DATA" position="inherit">
            <bs:query-master-reference master-reference="STAFF"/>

        </bs:datasource-master>
        <bs:datasource-master master-name="data" position="inherit">
            <bs:query-master-reference master-reference="STAFF"/>

        </bs:datasource-master>
        <bs:query-master master-name="STAFF">
            <bs:query-statement master-reference="DB2">select STAFF.NAME,STAFF.YEARS,STAFF.SALARY from STAFF where (STAFF.YEARS = 7) </bs:query-statement>
            <bs:data-type column-name="NAME" type="varchar"/>
            <bs:data-type column-name="YEARS" type="integer"/>
            <bs:data-type column-name="SALARY" type="decimal"/>
            <!-- TableName = STAFF	 AliasTableName = STAFF	 FieldName = NAME	 TOTAL = 	 SORT = 	 ExtractionCnditions = 	 orStr = 	 type = varchar
 TableName = STAFF	 AliasTableName = STAFF	 FieldName = YEARS	 TOTAL = 	 SORT = 	 ExtractionCnditions = null	 orStr = null	 type = char
 TableName = STAFF	 AliasTableName = STAFF	 FieldName = SALARY	 TOTAL = 	 SORT = 	 ExtractionCnditions = 	 orStr = 	 type = decimal
-->

        </bs:query-master>
        <bs:database-resource-master master-name="DB2" driver="com.ibm.db2.jcc.DB2Driver" url="jdbc:db2://brain_db:50000/SAMPLE" userid="administrator" password="ZGIyYWRtaW4= "/>

    </bs:datasource-master-set>
    <fo:layout-master-set>
        <fo:simple-page-master master-name="A4H" page-height="210mm" page-width="297mm">
            <fo:region-body/>
        </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="A4H" bs:local-page-control="none">
        <fo:flow flow-name="xsl-region-body">
            <bs:block-container>
                <bs:include href="${base-dir}/sample/xml/table/tableSample4-page.xml"/>

            </bs:block-container>
        </fo:flow>
    </fo:page-sequence>
</fo:root>



ページレイアウトのサンプル(『<biz-Stream_home>/sample/xml/table/tableSample4-page.xml』)

<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Width="297mm" Height="210mm" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:bs="http://www.brainsellers.com/schema" xmlns:svg="http://www.brainsellers.com/schema" xmlns:form="http://www.brainsellers.com/schema" xmlns:pdf="http://www.brainsellers.com/schema" version="5.0.0">
    <fo:table x="17.817" y="195.634" font-family="MSGothic" font-style="PLAIN" max-rows="5" no-data-disabled="true" fix="false">
        <fo:table-column column-width="21.244"/>

        <fo:table-column column-width="21.244"/>

        <fo:table-column column-width="21.244"/>

        <fo:table-header>
            <fo:table-row line-height="9.859" border-width="0.1" border-color="0,0,0" background-color="192,192,192">
                <fo:table-cell align="horizon" text-align="center" cell-align="bottom" narrow="size">
                    <Label Name="NAME" X="0" Y="0" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">NAME</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="center" cell-align="bottom" narrow="size">
                    <Label Name="YEARS" X="0" Y="0" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">YEARS</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="center" cell-align="bottom" narrow="size">
                    <Label Name="SALARY" X="0" Y="0" Horizon="center" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">SALARY</Label>
                </fo:table-cell>
            </fo:table-row>
        </fo:table-header>
        <fo:table-body master-reference="STAFF-DATA">
            <fo:table-row line-height="9.859" border-width="0.1" border-color="0,0,0">
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Label Name="NAME" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon"/>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Label Name="YEARS" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon"/>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Currency Name="SALARY" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon" format="#,##0.000"/>
                </fo:table-cell>
            </fo:table-row>
        </fo:table-body>
    </fo:table>
    <fo:table x="86.127" y="195.282" font-family="MSGothic" font-style="PLAIN" max-rows="5" no-data-disabled="true" fix="false">
        <fo:table-column column-width="21.244"/>

        <fo:table-column column-width="21.244"/>

        <fo:table-column column-width="21.244"/>

        <fo:table-header>
            <fo:table-row line-height="9.859" border-width="0.1" border-color="0,0,0" background-color="192,192,192">
                <fo:table-cell align="horizon" text-align="center" cell-align="bottom" narrow="size">
                    <Label Name="NAME" X="0" Y="0" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">NAME</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="center" cell-align="bottom" narrow="size">
                    <Label Name="YEARS" X="0" Y="0" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">YEARS</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="center" cell-align="bottom" narrow="size">
                    <Label Name="SALARY" X="0" Y="0" Horizon="center" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">SALARY</Label>
                </fo:table-cell>
            </fo:table-row>
        </fo:table-header>
        <fo:table-body master-reference="STAFF-DATA">
            <fo:table-row line-height="9.859" border-width="0.1" border-color="0,0,0">
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Label Name="NAME" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon"/>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Currency Name="YEARS" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon" format="#,##0"/>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Currency Name="SALARY" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon" format="#,##0.000"/>
                </fo:table-cell>
            </fo:table-row>
        </fo:table-body>
    </fo:table>
    <fo:table x="153.028" y="195.282" font-family="MSGothic" font-style="PLAIN" max-rows="5" no-data-disabled="true" fix="false">
        <fo:table-column column-width="21.244"/>

        <fo:table-column column-width="21.244"/>

        <fo:table-column column-width="21.244"/>

        <fo:table-header>
            <fo:table-row line-height="9.859" border-width="0.1" border-color="0,0,0" background-color="192,192,192">
                <fo:table-cell align="horizon" text-align="center" cell-align="bottom" narrow="size">
                    <Label Name="NAME" X="0" Y="0" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">NAME</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="center" cell-align="bottom" narrow="size">
                    <Label Name="YEARS" X="0" Y="0" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">YEARS</Label>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="center" cell-align="bottom" narrow="size">
                    <Label Name="SALARY" X="0" Y="0" Horizon="center" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">SALARY</Label>
                </fo:table-cell>
            </fo:table-row>
        </fo:table-header>
        <fo:table-body master-reference="STAFF-DATA">
            <fo:table-row line-height="9.859" border-width="0.1" border-color="0,0,0">
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Label Name="NAME" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon"/>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Currency Name="YEARS" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon" format="#,##0"/>
                </fo:table-cell>
                <fo:table-cell align="horizon" text-align="left" cell-align="bottom" narrow="size">
                    <Currency Name="SALARY" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon" format="#,##0.000"/>
                </fo:table-cell>
            </fo:table-row>
        </fo:table-body>
    </fo:table>
</Layout>



生成されるPDF(『<biz-Stream_home>/sample/xml/table/tableSample4.pdf』)


fo:tableサンプル4

ページレイアウトをレイアウト・デザイナで表示すると上図のようになります。
検索結果が6件なので下図のようなPDFが生成されます。

fo:tableサンプル5

各fo:tableはmax-rows属性に'5'を指定しているため、最大5行までの繰返しとなります。
そして、各fo:tableのfo:table-bodyのmaster-reference属性にSTAFF-DATAを指定しています。
これにより、左の表にはデータの先頭から5件分が表示され、中央の表には残りの1件分が表示されます。
また、各fo:tableのno-data-disabled属性に"true"を指定しているので、fo:tableに設定されている
データソースのデータ件数が0件の右側の表は表自体が表示されません。