Waqas Ali

Waqas Ali

  • NA
  • 6
  • 7.7k

I have following table in asp.net and I want to generate exc

Jul 21 2014 6:10 PM
I have following table in asp.net and I want to generate excel with css and
arabic data also show in reoprt.I am using following but not arabic data appear
 in my Excel and not arabic data appear in my css.I am using asp.net c#


Response.ContentType = "application/x-msexcel"; Response.AddHeader("Content-Disposition", "attachment; filename=ExcelFile.xls");
Response.ContentEncoding = System.Text.Encoding.UTF8; StringWriter tw = new System.IO.StringWriter(); HtmlTextWriter

hw = new HtmlTextWriter(tw); tblid.RenderControl(hw); Response.Write(tw.ToString()); Response.End(); <style type="text/css" > .repFont { -webkit-transform: rotate(-90deg); -moz-transform: rotate(-90deg); width: 53px; } table { border: 1px solid black; border-spacing:0px; } td { border: 1px solid black; border-spacing:0px; font-size:11PX; text-align:center; padding: 0px; } .auto-style1 { height: 27px; } .bgtd1 { background-color:#FFFF99; } .title { color:#CC3333; } .titleMale { color:#3366FF; } .titleTotal { font-weight:bold; font-size:12PX; } .maintitle { font-size:12px; } .maintileArabic { color:#CC3333; padding-left: 187px; } .maintileEng { color:#3366FF; padding-left: 113px; padding-bottom: 11px; } </style> <table id="tblid" runat="server" border="1" > <tr class="bgtd1"> <td colspan="2" rowspan="2" class="title">Region</td> <td colspan="3" class="title"><span id="result_box" lang="ar" xml:lang="ar">??????? ?????</span></td> <td colspan="2" class="title"> ???????????</td> <td colspan="2" class="title">?????</td> <td colspan="2" class="title">?????</td> <td colspan="2" class="title">?????</td> <td colspan="2" class="title">?????</td>
<td colspan="2" class="title">?????</td> <td colspan="2" class="title">?????</td>
 <td colspan="2" class="title">?????</td> <td colspan="2" class="title">?????</td> <td colspan="2" class="title">?????</td>
 <td colspan="2" class="title">?????</td> <td colspan="2" class="title">?????</td> <td colspan="2" rowspan="2" class="title">
<span id="result_box2" lang="ar" xml:lang="ar">?????</span></td> </tr> <tr class="bgtd1"> <td colspan="3" class="auto-style1">
Grand Total</td> <td colspan="2" class="auto-style1">&nbsp;&nbsp;</td> <td colspan="2" class="auto-style1"> &nbsp;Musandam&nbsp;</td>
 <td colspan="2" class="auto-style1">&nbsp;Al-wusta&nbsp;</td> <td colspan="2" class="auto-style1">&nbsp;Alburaimi&nbsp;</td>
 <td colspan="2" class="auto-style1">&nbsp;Al-Dhahira&nbsp;</td> <td colspan="2" class="auto-style1">&nbsp;Dohfar&nbsp;</td>
<td colspan="2" class="auto-style1">&nbsp;&nbsp;Al-dhakhila&nbsp;</td> <td colspan="2" class="auto-style1">&nbsp;Al-sharqiya(n)&nbsp;</td>
 <td colspan="2" class="auto-style1">&nbsp;Al-sharqiyah&nbsp;</td> <td colspan="2" class="auto-style1">&nbsp;Albatiniah(s)&nbsp;</td> <td

 colspan="2" class="auto-style1">&nbsp;Al-Albatinah&nbsp;</td> <td colspan="2" class="auto-style1">&nbsp;Muscat&nbsp;</td> </tr> <tr> <td

colspan="2" class="bgtd1">Gender</td> <td class="title"><span id="result_box8" lang="ar" xml:lang="ar">&nbsp;?????&nbsp;</span></td> <td >
?</td> <td class="titleMale">?</td> <td >?</td> <td class="titleMale">?</td> <td >?</td> <td class="titleMale">?</td> <td >?</td> <td clas
s="titleMale">?</td> <td>?</td> <td class="titleMale" >?</td> <td >?</td> <td class="titleMale">?</td> <td >?</td> <td class="titleMale">
?</td> <td >?</td> <td class="titleMale">?</td> <td >?</td> <td class="titleMale">?</td> <td>?</td> <td class="titleMale">?</td> <td>?</td
> <td class="titleMale">?</td> <td>?</td> <td class="titleMale">?</td> <td >?</td> <td class="titleMale">?</td> <td colspan="2" class="bgtd1"><span id="result_box3" lang="ar" xml:lang="ar">???</span></td> </tr> <tr> <td colspan="2" class="bgtd1">Specialization</td> <td class="title">Total</td> <td>F</td> <td class="titleMale">M</td> <td>F</td> <td class="titleMale">M</td> <td>F</td> <td class="titleMale">M</td> <td>F</td> <td class="titleMale">M</td> <td>F</td> <td class="titleMale">M</td>
<td>F</td> <td class="titleMale">M</td> <td>F</td> <td class="titleMale">M</td> <td>F</td> <td class="titleMale">M</td> <td>F</td> <td class="titleMale">M</td> <td>F</td> <td class="titleMale">M</td> <td>F</td> <td class="titleMale">M</td> <td>F</td> <td class="titleMale">M</td> <td>F</td> <td class="titleMale">M</td> <td colspan="2" class="bgtd1" >
<span id="result_box4" lang="ar" xml:lang="ar">????</span></td> </tr> <tr> <td rowspan="4" class="bgtd1">
<div class="repFont bgtd1">Foundation</div></td> <td class="bgtd1">Engnieering</td> <td >120</td> <td>48</td>
<td class="titleMale">72</td> <td>0</td> <td class="titleMale">0</td> <td>0</td> <td class="titleMale">0</td> <td>1</td>
 <td class="titleMale">1</td> <td>0</td> <td class="titleMale">0</td> <td>1</td> <td class="titleMale">1</td> <td>0</td>
<td>0</td> <td>1</td> <td class="titleMale">1</td> <td>0</td> <td class="titleMale">0</td> <td>1</td> <td class="titleMale">1</td>
<td>0</td> <td class="titleMale">0</td> <td>1</td> <td class="titleMale">1</td> <td>0</td> <td class="titleMale">0</td>
 <td class="bgtd1">???????&nbsp;</td> <td rowspan="4" class="bgtd1"><div class="repFont ">&nbsp;?????&nbsp;</div></td> </tr>
<tr> <td class="bgtd1">Information Technology</td> <td>213</td> <td>147</td> <td class="titleMale">66</td> <td>1</td> <td clasws="titleMale">2</td> <td>0</td> <td class="titleMale">0</td> <td>1</td> <td class="titleMale">1</td> <td>0</td> <td class="titleMale">0</td> <td>1</td> <td class="titleMale">1</td> <td>0</td> <td>0</td> <td>1</td> <td class="titleMale">1</td> <td>0</td> <td class="titleMale">0</td> <td >1</td> <td class="titleMale">1</td> <td>0</td> <td class="titleMale">0</td> <td>1</td> <td class="titleMale">1</td> <td>0</td> <td class="titleMale">0</td> <td class="bgtd1">&nbsp;????????? ?????????&nbsp;</td> </tr> <tr> <td rowspan="2" class="bgtd1"><span class="titleTotal">Total</span></td> <td rowspan="2">313</td> <td >195</td> <td class="titleMale">138</td> <td>1</td> <td class="titleMale">2</td> <td>0</td> <td class="titleMale">0</td> <td>2</td> <td class="titleMale">2</td> <td>0</td> <td class="titleMale">0</td> <td>2</td> <td class="titleMale">2</td> <td>0</td> <td>0</td> <td>2</td> <td class="titleMale">2</td> <td>0</td> <td class="titleMale">0</td> <td>2</td> <td class="titleMale">2</td> <td>0</td> <td class="titleMale">0</td> <td>2</td> <td class="titleMale">2</td> <td>0</td> <td class="titleMale">0</td> <td rowspan="2" class="bgtd1" >??????</td> </tr> <tr> <td colspan="2">313</td> <td colspan="2">3</td> <td colspan="2">0</td> <td colspan="2">4</td> <td colspan="2">0</td> <td colspan="2">4</td> <td colspan="2">0</td> <td colspan="2">4</td> <td colspan="2">0</td> <td colspan="2">4</td> <td colspan="2">0</td> <td colspan="2">4</td> <td colspan="2">0</td> </tr> </table>

Answers (3)