best way to replicate something in excel:
1. Build the document how you want it to look in excel.
2. Save As 'html'
3. open the file in notepad and check out the content it creates.
You will notice if you put a page break on a row it will create
style='page-break-before:always; inside the TR tag of the first cell on
that page.
Hope that helps
Cheers
Pat
David Leney wrote:
Hello,
I’ve looked across the net and I can’t find out if its possible to put a
page break in an excel document. I’ve included an example script that I
got from a Coldfusion Book that I bought so that people know what I’m on
about.
I need to output data from a DB into excel and have it sorted on
separate pages. I can’t find the command to do it. I’m just a beginner
at cfm and don’t really know much XML or any other languages. Some tips
or advice would be good please.
<!---
Filename: FilmsToExcelPrettier.cfm
Author: Nate Weiss (NMW)
Purpose: Outputs film information for Microsoft Excel
--->
<!--- Retrieve information about films --->
<CFQUERY DATASOURCE="ows" NAME="GetFilms">
SELECT MovieTitle, AmountBudgeted
FROM Films
ORDER BY MovieTitle
</CFQUERY>
<!--- Set the content-type so Excel is invoked --->
<CFCONTENT TYPE="application/msexcel">
<!--- Suggest default filename for spreadsheet --->
<CFHEADER NAME="Content-Disposition" VALUE="filename=FilmBudgets.xls">
<!--- Include "XML Namespace" information to --->
<!--- allow using Excel "extensions" to HTML --->
<html
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head><title>Film Budgets</title></head>
<body>
<style TYPE="text/css">
.rowHeads {
color:white;
background:blue;
}
.titleCol {
width:400px;
font-style:italic;
font-family:verdana;
}
.priceCol {
width:170px;
font-family:verdana;
color:red;
mso-number-format:"\0022$\0022\#\,\#\#0\.00"
};
</style>
<!--- Output ordinary HTML table, which will --->
<!--- be displayed by Excel as a spreadsheet --->
<table>
<!--- Top row --->
<tr>
<th class="rowHeads">Movie Title</th>
<th class="rowHeads">Amount Budgeted</th>
</tr>
<!--- Data rows --->
<CFOUTPUT QUERY="GetFilms">
<tr>
<td class="titleCol">#MovieTitle#</td>
<td class="priceCol">#AmountBudgeted#</td>
</tr>
</CFOUTPUT>
<!--- Last row, with "total" formula --->
<CFSET FirstPriceCell = "B2">
<CFSET LastPriceCell = "B" & GetFilms.RecordCount + 1>
<CFSET TotalFormula = "SUM(#FirstPriceCell#:#LastPriceCell#)">
<CFOUTPUT>
<tr>
<td
class="titleCol"
style="font-weight:bold;background:yellow">Total:</td>
<td
class="priceCol"
style="font-weight:bold;background:yellow"
x:fmla="=#TotalFormula#"></td>
</tr>
</CFOUTPUT>
</table>
</body>
</html>
Thankyou
David Leney
---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/