CFDOCUMENTSECTION  
説明

PDF または FlashPaper 形式のドキュメントをセクションに分割します。このタグを cfdocumentitem と共に使用すると、各セクションに固有のヘッダ、フッタ、ページ番号を設定することができます。

 
カテゴリ

データ出力タグ

 
シンタックス
<cfdocument ...>

   <cfdocumentsection
      margintop = "number"
      marginbottom = "number"
      marginleft = "number"
      marginright = "number">

   HTML タグ、CFML タグ、および cfdocumentitem タグ
</cfdocumentsection>

</cfdocument>
 
関連項目

cfreport、cfdocument、cfdocumentitem

 
ヒストリ

ColdFusion MX 7: このタグおよび margintop、marginbottom、marginleft、marginright の各属性が追加されました。

 
使用方法

cfdocumentsection タグを使用して、レポートをセクションに分割します。それぞれの cfdocumentsection タグ内で、1 つ以上の cfdocumentitem タグを使用して、各セクションに固有のヘッダおよびフッタを指定することができます。

cfdocumentsection を使用する場合、ColdFusion MX は cfdocumentsection タグの外にある HTML と CFML を無視します。

以前のセクションまたは親である cfdocument タグで指定されていたマージンは、マージンに関する属性により無効になります。マージンに関する属性を指定する場合、その単位は cfdocument 親タグの unit 属性で制御されます。unit 属性のデフォルトの単位はインチです。

 
<cfquery datasource="cfdocexamples" name="empSalary">
SELECT Emp_ID, firstname, lastname, e.dept_id, salary, d.dept_name
FROM employee e, departmt d
WHERE e.dept_id = d.dept_id
ORDER BY d.dept_name
</cfquery>

<cfdocument format="PDF">
  <cfoutput query="empSalary" group="dept_id">
   <cfdocumentsection>
   <cfdocumentitem type="header">
      <font size="-3"><i>給与レポート</i></font>
   </cfdocumentitem>
   <cfdocumentitem type="footer">
      <font size="-3">Page #cfdocument.currentpagenumber#</font>
   </cfdocumentitem>      
   <h2>#dept_name#</h2>
    <table width="95%" border="2" cellspacing="2" cellpadding="2" >
     <tr>
       <th>従業員</th>
       <th>給与</th>
     </tr>
     <cfset deptTotal = 0 >
     <!--- 内側の cfoutput --->
     <cfoutput>
       <tr>
          <td><font size = "-1">
          #empSalary.lastname#, #empSalary.firstname#</font>
        </td>
        <td align="right"><font size="-1">
          #DollarFormat(empSalary.salary)#</font>
        </td>
         </tr>
       <cfset deptTotal = deptTotal + empSalary.salary>         
     </cfoutput>
      <tr>
          <td align="right"><font size="-1">Total</font></td>
        <td align="right"><font size="-1">#DollarFormat(deptTotal)#</font></td>
        </tr>
      <cfset deptTotal = 0>
      </table>
     </cfdocumentsection>
   </cfoutput>
</cfdocument> 
MARGINTOP  
  オプション
 

ページの上マージンをインチ (デフォルト) またはセンチメートルを単位として指定します。上マージンをセンチメートル単位で指定するには、unit="cm" 属性を cfdocument 親タグに含めます。

MARGINBOTTOM  
  オプション
 

ページの下マージンをインチ (デフォルト) またはセンチメートルを単位として指定します。下マージンをセンチメートル単位で指定するには、unit="cm" 属性を cfdocument 親タグに含めます。

MARGINLEFT  
  オプション
 

ページの左マージンをインチ (デフォルト) またはセンチメートルを単位として指定します。左マージンをセンチメートル単位で指定するには、unit="cm" 属性を cfdocument 親タグに含めます。

MARGINRIGHT  
  オプション
 

ページの右マージンをインチ (デフォルト) またはセンチメートルを単位として指定します。右マージンをセンチメートル単位で指定するには、unit="cm" 属性を cfdocument 親タグに含めます。