We have had great luck looping over the rows/columns and creating an html table that gets pushed to the clipboard. That then can be pasted directly into excel. Just remember to apply any formatters/labelFunctions to the results as you collect them.
Nice thing about this approach is that you make it generic for every DataGrid you encounter. (No need to rewrite the export routine for every grid.) Downside is that it does not work in OpenOffice. On Fri, Feb 26, 2010 at 12:57 AM, Eric DeCoff <[email protected]> wrote: > Frank, > > The following article explains it better > http://hillelcoren.com/2009/09/17/import-export-copy-paste-flex-datagrid/ > > > In Flex 3, in order to upload a file you need a small script on the server > (in Flex 4/Flash 10 the client is able to handle this locally). Included in > the source you’ll find two PHP files: csvImport.php and csvExport.php. To > support exporting the data from the DataGrid I’m leveraging a nice algorithm > written by Sasa Radovanovic <http://www.saskovic.com/blog/> explained in > this post <http://www.saskovic.com/blog/?p=3>. > > This solution is meant to work with plain text csv and tsv files, if you > need to support Excel (.xls) files I’d recommend checking out > as3xls<http://code.google.com/p/as3xls/> > . > > On Fri, Feb 26, 2010 at 12:48 AM, Eric DeCoff <[email protected]>wrote: > >> Frank, >> >> This is the ASP.NET <http://asp.net/> way to create excel page ( I'm >> sure you can easily adapt it ) >> Unless want to call Excel and populate it? >> >> >> Response.Clear(); >> Response.AddHeader("content-disposition", >> "attachment;filename=FileName.xls"); >> Response.Charset = ""; >> Response.Cache.SetCacheability(HttpCacheability.NoCache); >> Response.ContentType = "application/vnd.xls"; >> System.IO.StringWriter stringWrite = new System.IO.StringWriter(); >> System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); >> myDataGrid.RenderControl(htmlWrite); >> Response.Write(stringWrite.ToString()); >> Response.End(); >> >> >> Back to droid programing... >> >> >> >> On Thu, Feb 25, 2010 at 10:51 PM, Dale Bronk <[email protected]>wrote: >> >>> What about copying to the clipboard and pasting into Excel? >>> >>> >>> >>> *From:* [email protected] [mailto:[email protected]] *On Behalf Of *Frank G. >>> Torres >>> *Sent:* Thursday, February 25, 2010 9:22 PM >>> *To:* [email protected] >>> *Subject:* [AFFUG Discuss] Export a datagrid to Excel >>> >>> >>> >>> Using Flash 9, is it possible to export a DataGrid to Excel from the >>> browser without hitting a server page?...or is Flash 10 required? >>> >>> Thanks in advance. >>> >>> >>> ------------------------------------------------------------- >>> To unsubscribe from this list, simply email the list with unsubscribe in >>> the subject line >>> >>> For more info, see http://www.affug.com >>> Archive @ http://www.mail-archive.com/discussion%40affug.com/ >>> List hosted by FusionLink <http://www.fusionlink.com/> >>> ------------------------------------------------------------- >>> >>> ------------------------------------------------------------- >>> To unsubscribe from this list, simply email the list with unsubscribe in >>> the subject line >>> >>> For more info, see http://www.affug.com >>> Archive @ http://www.mail-archive.com/discussion%40affug.com/ >>> List hosted by FusionLink <http://www.fusionlink.com/> >>> ------------------------------------------------------------- >>> >> >> > -- Scott Talsma CTO, echoEleven
