View comments | RSS feed

cfdocumentsection

Description

Divides a PDF or FlashPaper document into sections. By using this tag in conjunction with a cfdocumentitem tag, each section can have unique headers, footers, and page numbers.

Category

Data output tags

Syntax

<cfdocument ...>

<cfdocumentsection
margintop = "number"
marginbottom = "number"
marginleft = "number"
marginright = "number">
mimetype = "text/plain" or "text/xml" or "image/jpeg" or
"image/png" or "image/gif"
src = "url or path relative to web root"
srcfile = "absolute path of file" HTML, CFML, and cfdocumentitem tags
</cfdocumentsection> </cfdocument>

See also

cfreport, cfdocument, cfdocumentitem

History

ColdFusion MX 7 Updater: Added the src, srcfile, and mimetype attributes.

ColdFusion MX 7: Added this tag and the margintop, marginbottom, marginleft, marginright attributes.

Attributes

Attribute Req/Opt Default Description

margintop

Optional

 

Specifies the top margin in inches (default) or centimeters. To specify the top margin in centimeters, include the unit="cm" attribute in the parent cfdocument tag.

marginbottom

Optional

 

Specifies the bottom margin in inches (default) or centimeters. To specify the bottom margin in centimeters, include the unit="cm" attribute in the parent cfdocument tag.

marginleft

Optional

 

Specifies the left margin in inches (default) or centimeters. To specify the left margin in centimeters, include the unit="cm" attribute in the parent cfdocument tag.

marginright

Optional

 

Specifies the right margin in inches (default) or centimeters. To specify the right margin in centimeters, include the unit="cm" attribute in the parent cfdocument tag.

mimetype

Optional

text/html

Specifies the MIME type of the source document. Commom MIME types include:

  • text/plain
  • text/xml
  • image/jpeg
  • image/png
  • image/gif

src

Optional

 

Specifies the URL or the relative path to the web root. You cannot specify both the src and srcfile attributes.

srcfile

Optional

 

Specifies the absolute path of a file that is on the server. You cannot specify both the src and srcfile attributes.

Usage

Use the cfdocumentsection tag to divide a report into sections. Within each cfdocumentsection tag, you can use one or more cfdocumentitem tags to specify unique headers and footers for each section.

When using cfdocumentsection, ColdFusion MX ignores HTML and CFML not enclosed within cfdocumentsection tags.

The margin attributes override margins specified in previous sections or in the parent cfdocument tag. If you specify margin attributes, the units are controlled by the unit attribute of the parent cfdocument tag; the unit attribute has a default value of inches.

Example

<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>Salary Report</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>Employee</th>
       <th>Salary</th>
     </tr>
     <cfset deptTotal = 0 >
     <!--- inner 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> 

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | KnowledgeBase | Bug Reporting

Version 7

Comments


Bijums said on Jun 19, 2007 at 3:47 PM :
cfdocumentsection descrition says : By using this tag in conjunction with a cfdocumentitem tag, each section can have unique headers, footers, and page numbers

The page number sequence is not unique to a cfdocument section. It still maintains the same page number sequence of the cfdocument tag irrespective of cfdocumentsection tag

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/7/htmldocs/00000238.htm