|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
[flex_india:5783] Saving data as a csvHi all, How can I save the data from Flex in a csv format using asp or aspx.I have a chart and a grid and I want to save thet data in the form of a csv. Thanks, Leena Jain --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@... To unsubscribe from this group, send email to flex_india-unsubscribe@... For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
[flex_india:5789] Re: Saving data as a csvYou can easily do that, You can construct the "CSV" string in Flex using Action script and send it to the server using HTTP using POST/GET or send the object to server as AMF using your AMF gateway like 'BalzeDZ' or any other service.
Thanks Gireesh On Jan 14, 2008 11:26 AM, Leena Jain <leenajain82@...> wrote:
|
|
|
[flex_india:5787] Re: Saving data as a csvHI Leena, Abdul has posted some tuts to export data in CSV from Datagrid http://www.abdulqabiz.com/blog/archives/flash_and_actionscript/datagriddataexporter.php hope this will help u On Jan 14, 10:56 am, Leena Jain <leenajai...@...> wrote: > Hi all, > > How can I save the data from Flex in a csv format using asp or aspx.I > have a chart and a grid and I want to save thet data in the form of a > csv. > > Thanks, > Leena Jain --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@... To unsubscribe from this group, send email to flex_india-unsubscribe@... For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
[flex_india:5796] Re: Saving data as a csvWell the link on Abdul's blog uses php to do the upload. But we are not allowed to use php, Can u help me out with some ASP or ASPX example. Because we are allowed to use only ASP or ASPX . Any pointers would be very helpful. Regards, Leena On Jan 14, 12:22 pm, Saravanan <saras...@...> wrote: > HI Leena, > > Abdul has posted some tuts to export data in CSV from Datagrid > > http://www.abdulqabiz.com/blog/archives/flash_and_actionscript/datagr... > > hope this will help u > > On Jan 14, 10:56 am, Leena Jain <leenajai...@...> wrote: > > > > > Hi all, > > > How can I save the data from Flex in a csv format using asp or aspx.I > > have a chart and a grid and I want to save thet data in the form of a > > csv. > > > Thanks, > > Leena Jain- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@... To unsubscribe from this group, send email to flex_india-unsubscribe@... For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
[flex_india:5797] Re: Saving data as a csvhi leena, hope this code extract will be helpfull to you function to convert the data into html string. private function convertDGToHTMLTable(dg:DataGrid):String { //Set default values var font:String = dg.getStyle('fontFamily'); var size:String = dg.getStyle('fontSize'); var str:String = ''; var colors:String = ''; var style:String = 'style="font-family:'+font+';font-size:'+size+'pt;"'; var hcolor:Array; //Retrieve the headercolor if(dg.getStyle("headerColor") != undefined) { hcolor = [dg.getStyle("headerColor")]; } else { hcolor = dg.getStyle("headerColors"); } //Set the htmltabel based upon knowlegde from the datagrid str+= '<table border ="1" width="'+dg.width+'"><thead><tr width="'+dg.width+'" style="background-color:#' +Number((hcolor[0])).toString(16)+'">'; //Set the tableheader data (retrieves information from the datagrid header for(var i:int = 0;i<dg.columns.length;i++) { colors = dg.getStyle("themeColor"); //dg.columns[i].headerText != undefined || if(dg.showHeaders != false) { str+="<th "+style+">"+dg.columns[i].headerText+"</th>"; } //else { // str+= "<th "+style+">"+dg.columns[i].dataField+"</th>"; //} } str += "</tr></thead><tbody>"; colors = dg.getStyle("alternatingRowColors"); //Loop through the records in the dataprovider and //insert the column information into the table for(var j:int =0;j<dg.dataProvider.length;j++) { str+="<tr width=\""+Math.ceil(dg.width)+"\">"; for(var k:int=0; k < dg.columns.length; k++) { //Do we still have a valid item? if(dg.dataProvider.getItemAt(j) != undefined && dg.dataProvider.getItemAt (j) != null) { str += "<td width=\""+Math.ceil(dg.columns[k].width)+"\" "+style+">"+dg.dataProvider.getItemAt(j)[ dg.columns[k].dataField]+"</td>"; } } str += "</tr>"; } str+="</tbody></table>"; return str; } invoke the aspx page and pass the html table string as url variables:- variables.htmltable = convertDGToHTMLTable(dgg1)//dgg1-datagrid var variables:URLVariables = new URLVariables(); public var urlExcelExport:String="http://localhost:2581/excelconvert/Default.aspx"; var u:URLRequest = new URLRequest(urlExcelExport); u.data = variables; u.method = URLRequestMethod.POST; navigateToURL(u,"_blank"); aspx page code:- Response.Clear(); Response.Buffer = true; Response.ContentType = "application/vnd.ms-excel"; Response.Charset = ""; this.EnableViewState = false; Response.AddHeader("Content-Disposition", "filename=" + fname + ".xls" + '"'); Response.Write(Request.Params["htmltable"]); Response.End(); there could be another approach as well where in instead of passing on the whole data as html string pass on only the params that result in this data and hit the db again using those params. hope the two appraches help -saurabh narula http://saurabhnarula.wordpress.com On Jan 14, 2008 2:23 PM, Leena Jain <leenajain82@...> wrote:
|
|
|
[flex_india:5800] Re: Saving data as a csvThanks On Jan 14, 2:08 pm, "saurabh narula" <reachsaurabhnar...@...> wrote: > hi leena, > hope this code extract will be helpfull to you > > function to convert the data into html string. > private function convertDGToHTMLTable(dg:DataGrid):String { > //Set default values > var font:String = dg.getStyle('fontFamily'); > var size:String = dg.getStyle('fontSize'); > var str:String = ''; > var colors:String = ''; > var style:String = > 'style="font-family:'+font+';font-size:'+size+'pt;"'; > var hcolor:Array; > //Retrieve the headercolor > if(dg.getStyle("headerColor") != undefined) { > hcolor = [dg.getStyle("headerColor")]; > } else { > hcolor = dg.getStyle("headerColors"); > } > > //Set the htmltabel based upon knowlegde from the datagrid > str+= '<table border ="1" width="'+dg.width+'"><thead><tr > width="'+dg.width+'" style="background-color:#' > +Number((hcolor[0])).toString(16)+'">'; > > //Set the tableheader data (retrieves information from the > datagrid header > > for(var i:int = 0;i<dg.columns.length;i++) { > colors = dg.getStyle("themeColor"); > //dg.columns[i].headerText != undefined || > if(dg.showHeaders != false) { > str+="<th "+style+">"+dg.columns[i].headerText+"</th>"; > } > //else { > // str+= "<th > "+style+">"+dg.columns[i].dataField+"</th>"; > //} > } > str += "</tr></thead><tbody>"; > > colors = dg.getStyle("alternatingRowColors"); > > //Loop through the records in the dataprovider and > //insert the column information into the table > for(var j:int =0;j<dg.dataProvider.length;j++) { > > str+="<tr width=\""+Math.ceil(dg.width)+"\">"; > > for(var k:int=0; k < dg.columns.length; k++) { > > //Do we still have a valid item? > if(dg.dataProvider.getItemAt(j) != undefined && > dg.dataProvider.getItemAt(j) != null) { > > str += "<td > width=\""+Math.ceil(dg.columns[k].width)+"\" > "+style+">"+dg.dataProvider.getItemAt(j)[dg.columns[k].dataField]+"</td>"; > } > } > str += "</tr>"; > } > str+="</tbody></table>"; > > return str; > } > > invoke the aspx page and pass the html table string as url variables:- > > variables.htmltable = convertDGToHTMLTable(dgg1)//dgg1-datagrid > var variables:URLVariables = new URLVariables(); > public var urlExcelExport:String="http://localhost:2581/excelconvert/Default.aspx"; > var u:URLRequest = new URLRequest(urlExcelExport); > u.data = variables; > u.method = URLRequestMethod.POST; > navigateToURL(u,"_blank"); > > aspx page code:- > Response.Clear(); > Response.Buffer = true; > Response.ContentType = "application/vnd.ms-excel"; > Response.Charset = ""; > this.EnableViewState = false; > Response.AddHeader("Content-Disposition", "filename=" + fname + > ".xls" + '"'); > Response.Write(Request.Params["htmltable"]); > Response.End(); > > there could be another approach as well > where in instead of passing on the whole data as html string pass on only > the params that result in this data and hit the db again using those params. > > hope the two appraches help > > -saurabh narulahttp://saurabhnarula.wordpress.com > > On Jan 14, 2008 2:23 PM, Leena Jain <leenajai...@...> wrote: > > > > > > > Well the link on Abdul's blog uses php to do the upload. But we are > > not allowed to use php, Can u help me out with some ASP or ASPX > > example. Because we are allowed to use only ASP or ASPX . > > Any pointers would be very helpful. > > > Regards, > > Leena > > > On Jan 14, 12:22pm, Saravanan <saras...@...> wrote: > > > HI Leena, > > > > Abdul has posted some tuts to export data in CSV from Datagrid > > > >http://www.abdulqabiz.com/blog/archives/flash_and_actionscript/datagr... > > > > hope this will help u > > > > On Jan 14, 10:56 am, Leena Jain <leenajai...@...> wrote: > > > > > Hi all, > > > > > How can I save the data from Flex in a csv format using asp or aspx.I > > > > have a chart and a grid and I want to save thet data in the form of a > > > > csv. > > > > > Thanks, > > > > Leena Jain- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@... To unsubscribe from this group, send email to flex_india-unsubscribe@... For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |