biz-StreamマニュアルXMLページレイアウトタグ リファレンス第3章 テキスト3.2 横書きテキスト<Label>

3.2 横書きテキスト<Label>


3.2.1機能説明

横書きテキストの定義を行います。

3.2.2属性説明

属性名 指定 説明 指定内容 初期値
Name 任意 名前 CDATA
Width 任意 描画領域の幅 CDATA
Height 任意 描画領域の高さ CDATA
X 任意 X座標 CDATA 0
Y 任意 Y座標 CDATA 0
Unit 任意 単位 (Choice) mm / cm / in / px / pt mm
Horizon 任意 水平方向の配置 (Choice) left / center / right / even left
Vertical 任意 垂直方向の配置 (Choice) top / center / bottom / even bottom
Vector 任意 文字方向 (Choice) horizon ※1 horizon
CharSpace 任意 文字間隔 CDATA 0
Font 任意 フォント種類 (Choice) ライブラリ共通ガイド
6.2 横書きフォント』を参照
MSGothic
GaijiFont 任意 外字フォント種類 (Choice) ライブラリ共通ガイド
6.6 外字フォント』を参照
FontColor 任意 フォントカラー CDATA 0
FontSize 任意 フォントサイズ CDATA 8
FontStyle 任意 フォントスタイル (Choice) PLAIN / BOLD / ITALIC / BOLD-ITALIC PLAIN
FontEncoding 任意 フォントエンコーディング (Choice) 90ms-RKSJ-H / 90ms-RKSJ-V / 90msp-RKSJ-H / 90msp-RKSJ-V / UniJIS-UTF16-H / UniJIS-UTF16-V フォントごとのデフォルト値
Rate 任意 拡大縮小率 CDATA ※2 100
Narrow 任意 領域にデータが入りきらない場合の圧縮方法 (Choice) horizon / size / none horizon
MaxLength 任意 表示する最大文字数 CDATA
  • (注)初期値:出荷時のXML デフォルト情報(default_values.properties)値を表します。ユーザにより値の変更が行われた場合は内容が異なります。
  • ※1Vector 属性に"vertical"を指定することにより、縦書きテキストとして使用することも可能ですが、表示 および、パフォーマンスの観点から推奨できません。
  • ※2Rate 属性とNarrow 属性の値を元に計算された文字サイズは、そのサイズを適用した文字列が要素の定義領域内に収まる場合のみ、計算された値がそのまま使用されます。


3.2.3記述例

テキストの指定方法に関するサンプルです。テキスト指定には次の2つの方法があります。

  • Label タグのcontent(#PCDATA)で、テキストを直接指定
  • Name 属性にページレイアウト情報外部からデータを取得するためのKEY を指定

Label サンプル1

Label サンプル1 (『<biz-Stream_home>/sample/xml/Label/Labelsample1.xml Labelサンプル1』)

<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Name="LabelSample1" Width="120" Height="60" X="5" Y="15" 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">
    <!-- (1)label1 -->

    <Square Width="100" Height="10" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label1" Width="100" Height="10" Y="30" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="10" FontStyle="PLAIN" Narrow="horizon">表示内容の直接指定</Label>
    <!-- (2)company_name -->

    <Square Width="100" Height="10" Y="15" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="company_name" Width="100" Height="10" Y="15" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="10" FontStyle="PLAIN" Narrow="horizon"/>
    <!-- (3)company_name_empty -->

    <Square Width="100" Height="10" Y="30" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="company_name_empty" Width="100" Height="10" Y="0" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="10" FontStyle="PLAIN" Narrow="horizon"/>
</Layout>

生成されるPDF (『<biz-Stream_home>/sample/xml/Label/LabelSample1.pdf Labelサンプル1』)


Labelサンプル1
  • label1:Label タグのcontent で直接表示内容の指定を行っています。
  • company_name:Name 属性でデータベースのフィールド名を指定し、レイアウト情報外部からデータを取得しています。
    company_name 内容 : ブレインセラーズ・ドットコム
  • company_name_empty:Name 属性でデータベースのフィールド名を指定し、レイアウト情報外部からデータを取得しています。
    company_name_empty 内容 : データなし

Label サンプル2

水平方向の配置(Horizon 属性)に関するサンプルです。

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

<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Name="LabelSample2" Width="60" Height="65" X="5" Y="15" 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">
    <!-- (1)label1 -->

    <Square Width="50" Height="5" Y="0" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label1" Width="50" Height="5" Y="40" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">指定なし</Label>
    <!-- (2)label2 -->

    <Square Width="50" Height="5" Y="10" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label2" Width="50" Height="5" Y="30" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">左揃え</Label>
    <!-- (3)label3 -->

    <Square Width="50" Height="5" Y="20" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label3" Width="50" Height="5" Y="20" Horizon="center" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">中央揃え</Label>
    <!-- (4)label4 -->

    <Square Width="50" Height="5" Y="30" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label4" Width="50" Height="5" Y="10" Horizon="right" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">右揃え</Label>
    <!-- (5)label5 -->

    <Square Width="50" Height="5" Y="40" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label5" Width="50" Height="5" Y="0" Horizon="even" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">均等割付</Label>
</Layout>

生成されるPDF (『/bs/sample/xml/Label/LabelSample2.pdf Labelサンプル2』)


Labelサンプル2
  • label1:label1: Horizon 指定なし("left 指定と同内容")
  • label2: Horizon = "left"
  • label3: Horizon = "center"
  • label4: Horizon = "right"
  • label5: Horizon = "even"

Label サンプル3

指定領域(X,Y,Width,Heightの各属性で指定)にデータが入りきらない場合の圧縮方法(Narrow属性)に
関するサンプルです。

(『<biz-Stream_home>/sample/xml/Label/Labelsample3.xml Labelサンプル3』)
<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Name="LabelSample3" Width="50" Height="50" X="5" 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">
    <!-- (1)label1 -->

    <Square Width="15" Height="5" Y="30" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label1" Width="15" Height="5" Y="30" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">指定なしレイアウトサンプル</Label>
    <!-- (2)label2 -->

    <Square Width="15" Height="5" Y="20" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label2" Width="15" Height="5" Y="20" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">幅圧縮レイアウトサンプル</Label>
    <!-- (3)label3 -->

    <Square Width="15" Height="5" Y="10" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label3" Width="15" Height="5" Y="10" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="size">フォントサイズ縮小レイアウトサンプル</Label>
    <!-- (4)label4 -->

    <Square Width="15" Height="5" Y="0" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label4" Width="15" Height="5" Y="0" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="none">圧縮なしレイアウトサンプル</Label>
</Layout>

生成されるPDF (『<biz-Stream_home>/sample/xml/Label/LabelSample3.pdf Labelサンプル3』)


Labelサンプル3
  • label1: Narrow 指定なし("horizon"指定と同内容)
  • label2: Narrow = "horizon"
  • label3: Narrow = "size"
  • label4: Narrow = "none"

Label サンプル4

拡大縮小率(Rate属性)に関するサンプルです。
拡大縮小にはNarrow属性の値が反映されるため、必ず2つの属性を併用してください。

  • Narrow="size" ⇒ フォントサイズによる拡大 / 縮小
  • Narrow="horizon" ⇒ 水平比率による拡大 / 縮小
  • Narrow="none" ⇒ 拡大縮小なし

Labelサンプル4(『<biz-Stream_home>/sample/xml/Label/Labelsample4.xml Labelサンプル4』)

<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Name="LabelSample4" Width="100" Height="140" 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">
    <!-- (1)label1 -->

    <Square Width="70" Height="10" Y="105" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label1" Width="70" Height="10" Y="105" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">指定なし</Label>
    <!-- (2)label2 -->

    <Square Width="70" Height="10" Y="90" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label2" Width="70" Height="10" Y="90" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Rate="100" Narrow="horizon">拡大縮小率100%</Label>
    <!-- (3)label3 -->

    <Square Width="70" Height="10" Y="75" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label3" Width="70" Height="10" Y="75" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Rate="50" Narrow="size">拡大縮小率50%(1)</Label>
    <!-- (4)label4 -->

    <Square Width="70" Height="10" Y="60" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label4" Width="70" Height="10" Y="60" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Rate="50" Narrow="horizon">拡大縮小率50%(2)</Label>
    <!-- (5)label5 -->

    <Square Width="70" Height="10" Y="45" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label5" Width="70" Height="10" Y="45" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Rate="50" Narrow="none">拡大縮小率50%(3)</Label>
    <!-- (6)label6 -->

    <Square Width="70" Height="10" Y="30" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label6" Width="70" Height="5" Y="30" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Rate="200" Narrow="size">拡大縮小率200%(1)</Label>
    <!-- (7)label7 -->

    <Square Width="70" Height="10" Y="15" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label7" Width="70" Height="10" Y="15" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Rate="200" Narrow="horizon">拡大縮小率200%(2)</Label>
    <!-- (8)label8 -->

    <Square Width="70" Height="10" Y="0" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label8" Width="70" Height="10" Y="0" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Rate="200" Narrow="none">拡大縮小率200%(3)</Label>
</Layout>

生成されるPDF (『<biz-Stream_home>/sample/xml/Label/LabelSample4.pdf Labelサンプル4』)


Labelサンプル4
  • label1: Rate 指定なし("100"指定と同内容)
  • label2: Rate = "100"
  • label3: Rate = "50"、Narrow="size"
  • label4: Rate = "50"、Narrow="horizon"
  • label5: Rate = "50"、Narrow="none"
  • label6: Rate = "200"、Narrow="size"
  • label7: Rate = "200"、Narrow="horizon"
  • label8: Rate = "200"、Narrow="none"
  • Narrow="size"
    ⇒ フォントサイズによる拡大 / 縮小
  • Narrow="horizon"
    ⇒ 水平比率による拡大 / 縮小
  • Narrow="none"
    ⇒ Rate 属性指定がある場合も拡大 / 縮小されません

Label サンプル5

文字間隔指定(CharSpace)に関するサンプルです。

Labelサンプル5 (『<biz-Stream_home>/sample/xml/Label/Labelsample5.xml Labelサンプル5』)

<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Name="LabelSample5" Width="70" Height="70" X="5" 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">
    <!-- (1)label1 -->

    <Square Width="50" Height="5" Y="40" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label1" Width="50" Height="5" Y="40" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">文字間隔指定なし</Label>
    <!-- (2)label2 -->

    <Square Width="50" Height="5" Y="30" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label2" Width="50" Height="5" Y="30" Horizon="left" Vertical="center" Vector="horizon" CharSpace="0" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">文字間隔指定0</Label>
    <!-- (3)label3 -->

    <Square Width="50" Height="5" Y="20" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label3" Width="50" Height="5" Y="20" Horizon="left" Vertical="center" Vector="horizon" CharSpace="1" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">文字間隔指定1</Label>
    <!-- (4)label4 -->

    <Square Width="50" Height="5" Y="10" LineColor="14,0,176" LineStyle="Solid"/>

    <Label Name="label4" Width="50" Height="5" Y="10" Horizon="left" Vertical="center" Vector="horizon" CharSpace="5" Font="MSGothic" FontStyle="PLAIN" Narrow="horizon">文字間隔指定5</Label>
</Layout>

生成されるPDF (『<biz-Stream_home>/sample/xml/Label/LabelSample5.pdf Labelサンプル5』)


Labelサンプル5
  • label1: CharSpace 指定なし("0"指定と同内容)
  • label2: CharSpace = "0"
  • label3: CharSpace = "1"
  • label4: CharSpace = "5"