0

Does anyone know if it is possible to format the Excel spreadsheet (dynamically created using ColdFusion and pulling from a MySQL database) to have the Excel file automatically set to landscape, rather than portrait for printing. My client wants that Excel spreadsheet formatted for him. I have the borders and colors and headers set, but I'm told they've seen this done before, so I was hoping someone could tell me how, or point me in the right direction. I've done a google search, but can't find anything about this. The only way that I can imagine it could be done, is if the data is being put into an Excel file that is acting as a template, with all the features set in advance, but I don't know if that's possible using ColdFusion, nor have I ever seen it done. Any help is greatly appreciated.

Thank you in advance.
elizabeth

Edited by elizabeth1: n/a

4
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by danarashad
-1

use this css property..

mso-page-orientation:landscape;

apply this to the body.

check this page comment # 3. You can get a idea if u need a code level help.

else reply to the thread again

0

you can save an existing excel file to a .xml file and wrap it with

<cfsavecontent variable="strXmlData">
<cfoutput>
    <!--- Excel that was converted into an xml here --->
</cfoutput>
</cfsavecontent>

<cfheader
name="content-disposition"
value="attachment; filename=franchisee.xml"
/>
 

<cfcontent
type="application/msexcel"
variable="#ToBinary( ToBase64( strXmlData.Trim().ReplaceAll( '>\s+', '>' ).ReplaceAll( '\s+<', '<' ) ) )#"
/>

Or you can check out POI Utility by Ben Nadel. Its a great utility for reading and writing excel file.

0

Does anyone know if it is possible to format the Excel spreadsheet (dynamically created using ColdFusion and pulling from a MySQL database) to have the Excel file automatically set to landscape, rather than portrait for printing. My client wants that Excel spreadsheet formatted for him. I have the borders and colors and headers set, but I'm told they've seen this done before, so I was hoping someone could tell me how, or point me in the right direction. I've done a google search, but can't find anything about this. The only way that I can imagine it could be done, is if the data is being put into an Excel file that is acting as a template, with all the features set in advance, but I don't know if that's possible using ColdFusion, nor have I ever seen it done. Any help is greatly appreciated.

Thank you in advance.
elizabeth

I am currently doing this, but I don't use landscape. I am changing font colors, cell shading. The following links should work.

http://www.bennadel.com/blog/484-Adding-Basic-CSS-Support-To-My-POI-Utility-ColdFusion-Component-For-Excel-Creation.htm http://www.bennadel.com/blog/474-ColdFusion-Component-Wrapper-For-POI-To-Read-And-Write-Excel-Files.htm http://www.d-ross.org/index.cfm?objectid=9C65ECEC-508B-E116-6F8A9F878188D7CA http://www.bennadel.com/blog/865-POIUtility-cfc-Examples-For-Reading-And-Writing-Excel-Files-In-ColdFusion.htm
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.