I wrote code using Ajax/C# that will append data with jQuery to HTML table ,this is the table headers:
- table id='tblUsers' class='table table-striped table-condensed table-hover table-bordered table-responsive' >
- <tr>
- <th>Customer IDth>
- <th>Customer Nameth>
- <th>File #th>
- <th>Territoryth>
- <th>Start Dateth>
- <th>Goods Descth>
- <th>Custom Declarationth>
- <th>Quantityth>
- <th>Weightth>
- <th>Volumetric Weightth>
- <th>Mortage Amountth>
- <th>Invoice#th>
- <th>Invoice Amountth>
- tr>
- table>
- $.ajax({
- url: "WebService.asmx/showResult",
- type: "post",
- data: JSON.stringify({
- "dateFrom": $('#txtDateFrom').val(),
- "dateTo": $('#txtDateTo').val(),
- "ddlType": $("#ddlType").children("option").filter(":selected").val(),
- "ddlTer": $("#ddlTer").children("option").filter(":selected").val(),
- "ddlFilter": $("#filter").children("option").filter(":selected").val()
- }), // parameters
- beforeSend: function () {
- $('#loader').html('
');
- },
- contentType: "application/json; charset=utf-8",
- success: function (result) {
- $('#loader').html('');
- document.getElementById('filter').style.display = 'inherit';
- document.getElementById('logo').style.display = 'none';
- document.getElementById('exp').style.display = 'inherit';
- //To delete the whole tr except the first one.
- $("#tblUsers").find("tr:gt(0)").remove();
- $('#tblUsers').append(JSON.stringify(result));
- if ($("#ddlType").val() != 0) {
- document.getElementById('filter').style.display = 'none';
- }
- },
- error: function () {
- alert('error');
- }
- });
- var sp = db.divideTypes(dateFrom, dateTo, ddlFilter).ToList();
- foreach (var u in sp)
- {
- result += "
"; ";- result += "
" + u.custid + " ";- result += "
" + u.custname + " ";- result += "
" + u.depno + " ";- result += "
" + u.Terr + " ";- result += "
" + u.deidate + " ";- result += "
" + u.gooddesc+ " ";- result += "
" + u.custdec + " ";- result += "
" + u.pkg + " ";- result += "
" + u.wt + " ";- result += "
" + u.vwt + " ";- result += "
" + u.lcamt+ " ";- result += "
" + u.invno + " ";- result += "
" + u.invamt + " ";- result += "
"; - result += "
- }
i tried to read articles over the web to export excel table as excel file but using JQuery, http://wsnippets.com/export-html-table-data-excel-sheet-using-jquery/
Heading
and there's a lot of articles like this all of them failed because i want to render Arabic letters so the letters looks strange.
i notice that there's an article in stackOverflow:http://stackoverflow.com/questions/17988417/export-data-table-with-arabic-data-to-excel
that talk about a situation similar to mine, but really i don't know how to implement it.
Fares AyyadPosted Oct 20, 2016, 2:26 AM
Ekrem Tapan
i add the html and body tag but still doesn't workEkrem TapanPosted Oct 17, 2016, 2:11 AM
Fares AyyadPosted Oct 16, 2016, 4:39 AM
Bikesh SrivastavaPosted Oct 12, 2016, 9:21 AM