[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1232
  • Last Modified:

force page break in excel

i am outputing the results of a cfm page into sql, by way of cf header:
     <cfheader name="Content-Disposition" value="inline; filename=payPeriodSummary_#datePart('yyyy', getPayPeriodData.pp_endDate)#_#datePart('m', getPayPeriodData.pp_endDate)#_#datePart('d', getPayPeriodData.pp_endDate)#.xls">
<cfcontent type="text/tabdelimited">

i need to insert a page break every 30 lines.  i tried <br style="page-break-before: always">, but excel doesn't acknowledge it.  how can this be done?
0
meyerc74
Asked:
meyerc74
  • 3
  • 3
  • 2
  • +1
1 Solution
 
kkhippleCommented:
have a look at this solution:

Inserting an excel page break as a character in an HTML output file renamed to .xls
http://www.experts-exchange.com/Web/WebDevSoftware/ColdFusion/Q_20838162.html
0
 
pinaldaveCommented:
Hi meyerc74,
use #chr(13)# at the end instead of br... that is what I do.

Regards,
---Pinal
0
 
meyerc74Author Commented:
chr(13) is just a carriage return...i need to force a page break, so it will print properly
0
How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

 
kkhippleCommented:
try chr(12)
0
 
meyerc74Author Commented:
excel doesn't recognize chr(12)
0
 
kkhippleCommented:
im not sure then. .  .  i think what you are trying to do will probably be best accomplished by using a COM object.. there seems to be no way to do with your basic HTML

and you're right... EXCEL will not recognize <br style="page-break-before: always">    or any other derivation of it...  
if you do find a means.. please let everyone else know


good luck..
0
 
Jerry_PangCommented:
i must agree to use excel com object but i dont recommened to use COM object with Excel,
coldfusion 6 has a nasty bug about excel com object.
i dont know if the bug is solved now.

Using Com object may solve your problem but will also add lots of issue with EXCEL bug.
Bug # 49840
http://www.macromedia.com/support/coldfusion/releasenotes/mx/mx61_fixed_bugs.html#COMFixes

how about generating multiple xls files?
or generating xls files with different sheets? (without using com object ofcourse)
or generating a rtf or doc files or an html file instead of xls file.

i think the other MsOffice COM objects are ok but not excel Com Object.
0
 
meyerc74Author Commented:
unfortunetly, it has to be excel as the end user has to be able to modify and calculate the values.  this end user is also quite, how say i'll say, computer challenged.

in the intrium i told her how to manual enter page breaks in the desired places.  maybe i will try the com object, my company is abandoning coldfusion for asp.net so we stopped upgrading at 4.5.
0
 
Jerry_PangCommented:
About the excel bug, it cannot close the excel process, the more you press refresh- the more excel process will be created. you cant end task this excel processes except to restart the computer.
happens only in coldfusionMX.

Checkout this site. VBScript & Excel
http://www.greggriffiths.org/webdev/both/excel/index.html

you can use similar code for coldfusion.

use the HPagebreak.add in excel com object to add pagebreaks.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now