Home > ColdFusion > ColdFusion 9 – How to Stream a CFSpreadSheet to the Browser

ColdFusion 9 – How to Stream a CFSpreadSheet to the Browser

I have seen this question raised a few times, but found no examples in the documentation.  So in case you were wondering how to stream a spreadsheet to a browser:

Code:

<!--- create your spreadsheet --->
<cfset sheet = SpreadSheetNew()>
<cfset SpreadsheetAddRow(sheet, "foo,bar")>

<!--- stream it to the browser --->
<cfheader name="Content-Disposition" value="inline; filename=foo.xls">
<cfcontent type="application/vnd.ms-excel" variable="#SpreadSheetReadBinary(sheet)#">

 

Advertisements
Categories: ColdFusion Tags: ,
  1. Euro
    October 6, 2011 at 3:13 am

    Thanks

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: