Email Friendly View

5 views
Skip to first unread message

Rajasekhar

unread,
Sep 14, 2011, 3:52:57 AM9/14/11
to Flex India Community, rajase...@polaris.co.in, vrajasek...@gmail.com
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;
}

nishantkyal

unread,
Sep 15, 2011, 1:57:27 AM9/15/11
to flex_...@googlegroups.com, rajase...@polaris.co.in, vrajasek...@gmail.com
Seems more like a problem of how the email client renders tables in html. Try comparing it against some other html that you know renders properly in the email client. You could also try getting some email with tables and see what their source looks like.

Rajasekhar

unread,
Sep 15, 2011, 4:42:49 AM9/15/11
to Flex India Community
Hi Nishant
The problem is resolved .
thanks for u r reply.
Reply all
Reply to author
Forward
0 new messages