3.9.1機能説明
現在のページ番号を表示したい場合に使用する要素です。
3.9.2属性説明
属性名 | 指定 | 説明 | 型 | 指定内容 | 初期値 |
name | 任意 | 名前 | CDATA | | - |
x | 任意 | X座標 | CDATA | | 0 |
y | 任意 | Y座標 | CDATA | | 0 |
unit | 任意 | 単位 | (Choice) | mm / cm / in / px/ pt | |
width | 必須 | 領域の幅 | CDATA | | - |
height | 任意 | 領域の高さ | CDATA | | - |
text-align | 任意 | テキストの配置(水平方向) | (Choice) | left / center / right | left |
line-align | 任意 | 行の配置(垂直方向) | (Choice) | top / center / bottom / even | bottom |
narrow | 任意 | 領域にデータが入りきらない場合の圧縮方法 | (Choice) | size / none / horizon | horizon |
font-family | 任意 | フォント種類 | (Choice) | ライブラリ共通ガイド 『6.2.1 横書きフォント』を参照 | MSGothic |
font-color | 任意 | フォントの色 | CDATA | | 0 |
font-size | 任意 | フォントサイズ | CDATA | | 8 |
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 |
フォントごとのデフォルト値 |
char-space | 任意 | 文字間隔 | CDATA | | 0 |
start-number | 任意 | 開始ページ番号 | CDATA | | - |
page-number | 任意 | 表示種別 | (Choice) | page:ページ番号 / total:総ページ数 | page |
local-page | 任意 | ローカルページ カウンタ値の使用 ※1 | (Choice) | false:文書全体のページ / true:ローカルページカウンタによるページ | false |
format | 任意 | ページ番号の書式設定 | CDATA | | - |
- (注)初期値:出荷時のXML デフォルト情報(default_values.properties)値を表します。ユーザにより値の変更が行われた場合は内容が異なります。
- ※1local-page="true" とした場合、start-number 属性の指定は無効となり警告メッセージをエラー出力先に出力します。
表示種別<page-number>とローカルページカウンタ<local-page>の組み合わせ
属性の値との組み合わせにより以下の値を出力します。
ローカルページ番号をコントロールするためドキュメントレイアウトの設定が必須です。XMLドキュメントレイアウトタグ リファレンスガイド『4.3 ページシーケンス<fo:page-sequence>』をご参照ください。
属性指定 | 出力される値 |
page-number="page" local-page="false" | 文書全体でカウントされるページ番号 |
page-number="total" local-page="false" | 文書全体の総ページ数 |
page-number="page" local-page="true" | ローカルページカウントによるページ番号 |
page-number="total" local-page="true" | ローカルページカウントがリセットされる間のページ数 |
設定例
- ローカルページカウントを使用しない場合のページ番号表示(local-page="false")
- ①文書全体でカウントされるページ番号
- ②文書全体の総ページ数
- ローカルページカウントを使用する場合のページ番号表示(local-page="true")
- ③ローカルページカウントによるページ番号
- ④ローカルページカウントがリセットされる間のページ数
- ←3番目のページで、ページ番号を初期化する
(bs:local-page-control="init")
3.9.3記述例
page-numberサンプル1
<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Name="page-number" Width="100pt" Height="100pt" 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">
<GroupAlignment Horizon="left" Vertical="bottom" Vector="vertical" LineSpace="1mm" Narrow="size">
<!-- (1)page-number1 初期値 -->
<page-number text-align="left" line-align="bottom" font-family="MSGothic" font-color="255,0,0" font-size="20" font-style="PLAIN" narrow="horizon" page-number="page" local-page="false"/>
<!-- (2)page-number2 書式設定なし -->
<page-number text-align="left" line-align="bottom" format="${page-number}" font-family="MSGothic" font-color="0,255,0" font-size="20" font-style="PLAIN" narrow="horizon" page-number="page" local-page="false"/>
<!-- (3)page-number3 書式設定あり -->
<page-number text-align="left" line-align="bottom" format="-${page-number}-" font-family="MSGothic" font-color="0,0,255" font-size="20" font-style="PLAIN" narrow="horizon" page-number="page" local-page="false"/>
</GroupAlignment>
</Layout>
書式設定(format属性)では ${page-number} はページ番号を表します。
- ①page-number1: 初期値
- ②page-number2: 書式設定でページ番号だけを表示します。
- ③page-number3: 書式設定でページ番号の両側に'-'を表示します。
page-number サンプル2
ページ番号と総ページを標示するサンプルです。
<?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:document-properties-set>
<bs:document-view initial-page="1" disposition="two-column-left" menubar="true" toolbar="true" window-ui="true" thumbnail="false" full-screen="false" fit-window="false" center-window="false"/>
</bs:document-properties-set>
<fo:layout-master-set>
<fo:simple-page-master master-name="sample" page-height="40px" page-width="100px">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="sample" bs:local-page-control="none">
<fo:flow flow-name="xsl-region-body">
<bs:block-container>
<bs:include href="${base-dir}/sample/xml/page-number/page-numberSample2-page.xml"/>
</bs:block-container>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="sample" bs:local-page-control="none">
<fo:flow flow-name="xsl-region-body">
<bs:block-container>
<bs:include href="${base-dir}/sample/xml/page-number/page-numberSample2-page.xml"/>
</bs:block-container>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="sample" bs:local-page-control="none">
<fo:flow flow-name="xsl-region-body">
<bs:block-container>
<bs:include href="${base-dir}/sample/xml/page-number/page-numberSample2-page.xml"/>
</bs:block-container>
</fo:flow>
</fo:page-sequence>
</fo:root>
<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Name="page-number" Width="100pt" Height="40pt" 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">
<GroupAlignment Width="100px" Horizon="center" Vertical="bottom" Vector="horizon" LineSpace="1mm" Narrow="size">
<!-- (1)page-number ページ番号 -->
<page-number text-align="left" line-align="bottom" font-family="MSGothic" font-size="20" font-style="PLAIN" narrow="horizon" page-number="page" local-page="false"/>
<!-- 区切り文字 -->
<Label Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="20" FontStyle="PLAIN" Narrow="horizon">/</Label>
<!-- (2)page-number 総ページ番号 -->
<page-number text-align="left" line-align="bottom" font-family="MSGothic" font-size="20" font-style="PLAIN" narrow="horizon" page-number="total" local-page="false"/>
</GroupAlignment>
</Layout>
page-number属性で表示種別を指定します。
- ①page-number: page 現在のページ数
- ②page-number: total 総ページ数
- ※page-number: pageは前のページ番号を引き継ぐ
page-number サンプル3
ローカルページ番号と総ページを表示し、3番目のページでローカルページカウンタを初期化するサンプルです。
<?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:document-properties-set>
<bs:document-view initial-page="1" disposition="two-column-left" menubar="true" toolbar="true" window-ui="true" thumbnail="false" full-screen="false" fit-window="false" center-window="false"/>
</bs:document-properties-set>
<fo:layout-master-set>
<fo:simple-page-master master-name="sample" page-height="297mm" page-width="210mm">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="sample" name="bizsheet1" bs:local-page-control="none">
<fo:flow flow-name="xsl-region-body">
<bs:block-container>
<bs:include href="${base-dir}/sample/xml/page-number/page-numberSample3-page.xml"/>
</bs:block-container>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="sample" name="bizsheet2" bs:local-page-control="none">
<fo:flow flow-name="xsl-region-body">
<bs:block-container>
<bs:include href="${base-dir}/sample/xml/page-number/page-numberSample3-page.xml"/>
</bs:block-container>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="sample" name="bizsheet3" bs:local-page-control="init">
<fo:flow flow-name="xsl-region-body">
<bs:block-container>
<bs:include href="${base-dir}/sample/xml/page-number/page-numberSample3-page.xml"/>
</bs:block-container>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="sample" name="bizsheet4" bs:local-page-control="none">
<fo:flow flow-name="xsl-region-body">
<bs:block-container>
<bs:include href="${base-dir}/sample/xml/page-number/page-numberSample3-page.xml"/>
</bs:block-container>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="sample" name="bizsheet5" bs:local-page-control="none">
<fo:flow flow-name="xsl-region-body">
<bs:block-container>
<bs:include href="${base-dir}/sample/xml/page-number/page-numberSample3-page.xml"/>
</bs:block-container>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="sample" name="bizsheet6" bs:local-page-control="none">
<fo:flow flow-name="xsl-region-body">
<bs:block-container>
<bs:include href="${base-dir}/sample/xml/page-number/page-numberSample3-page.xml"/>
</bs:block-container>
</fo:flow>
</fo:page-sequence>
</fo:root>
(30行目抜粋)
<fo:page-sequence master-reference="sample" name="bizsheet3" bs:local-page-control="init">
<?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">
<page-number x="170" y="160" width="10" height="10" text-align="left" line-align="bottom" font-family="MSGothic" font-size="12" font-style="PLAIN" narrow="horizon" page-number="page" local-page="false"/>
<Label Width="140" Height="10" X="30" Y="160" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">page-number="page"local-page="false"の属性を持つページ番号:</Label>
<Label Width="140" Height="10" X="30" Y="140" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">page-number="total"local-page="false"の属性を持つページ番号:</Label>
<page-number x="170" y="140" width="10" height="10" text-align="left" line-align="bottom" font-family="MSGothic" font-size="12" font-style="PLAIN" narrow="horizon" page-number="total" local-page="false"/>
<page-number x="170" y="120" width="10" height="10" text-align="left" line-align="bottom" font-family="MSGothic" font-size="12" font-style="PLAIN" narrow="horizon" page-number="page" local-page="true"/>
<Label Width="140" Height="10" X="30" Y="120" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">page-number="page"local-page="true"の属性を持つページ番号:</Label>
<page-number x="170" y="100" width="10" height="10" text-align="left" line-align="bottom" font-family="MSGothic" font-size="12" font-style="PLAIN" narrow="horizon" page-number="total" local-page="true"/>
<Label Width="140" Height="10" X="30" Y="100" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">page-number="total"local-page="true"の属性を持つページ番号:</Label>
<Label Width="190" Height="10" X="30" Y="190" Horizon="left" Vertical="bottom" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">※3番目のページでローカルページカウンタを初期化(bs:local-page-control="init")</Label>
</Layout>