Rajasekhar
unread,Sep 14, 2011, 3:36:01 AM9/14/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to HyderabadFX, rajase...@polaris.co.in
Hi All,
I am facing one problem as per client requirement copy the Datagrid
data and while paste in outlook/lotus notes email body the same table
formatted grid should be displayed.so for that i converted datagrid as
html string and when i am pasting in email body the data displayed
as same html string not table formatted data .please see the below
code and send me if you have any solution regarding this
Regards,
Rajasekhar
public function
copyEmailFriendlyView(event:ContextMenuEvent):void
{
var htmlStr:String = convertToHtmlText(dg);
System.setClipboard(htmlStr);
htmlStr ="";
}
public function convertToHtmlText(dg):Strin{
//<html><body>
//</body></html>
var font = dg.getStyle('fontFamily');
var size = dg.getStyle('fontSize');
var str:String = '<table border="'+1+'" width="'+dg.width
+'">';
str +=' <head> <meta http-equiv="Content-Type" content="text/
html; charset=windows-1252"> <meta name="GENERATOR" content="Microsoft
FrontPage 4.0"> <meta name="ProgId"
content="FrontPage.Editor.Document"> </head>';
var colors = dg.getStyle("alternatingRowColors");
for(var j=0;j<dg.dataProvider.length;j++)
{
str += "<tr>"
var style = 'style="font-family:'+font+';font-
size:'+size+'pt;"';
if(ArrayCollection(dg.dataProvider).getItemAt(j) !
= undefined && ArrayCollection(dg.dataProvider).getItemAt(j) !=
null )
{
str += "<td width=
\""+Math.ceil(dg.columns[0].width)+"\" "+style
+">"+ArrayCollection(dg.dataProvider).getItemAt(j)
[dg.columns[0].dataField]+"</td>";
str += "<td width=
\""+Math.ceil(dg.columns[1].width)+"\" "+style
+">"+ArrayCollection(dg.dataProvider).getItemAt(j)
[dg.columns[1].dataField]+"</td>";
}
str += "</tr>";
}
str+="</table>";
return str;
}