Copy link to clipboard
Copied
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.
you can save an existing excel file to a .xml file and wrap it with
<cfsavecontent variable="strXmlData">
<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+<
Copy link to clipboard
Copied
you can save an existing excel file to a .xml file and wrap it with
<cfsavecontent variable="strXmlData">
<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.
Copy link to clipboard
Copied
Thanks for quick reply