I had tried that way but failed.
Below html code TournamentExport.html file:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=<charset>" />
<title><eventname></title>
</head>
<style type="text/css">
.infotable
{
border: 2px solid #000000;
padding: 8px;
background-color: #ffffff;
color: #000000;
font-family: Tahoma;
font-size: 12pt;
}
.eventname
{
font-size: 16pt;
font-weight: bold;
}
.description
{
font-weight: bold;
}
.league
{
}
.season
{
}
.financials
{
}
.info
{
}
.playerRankingsTable
{
border: 2px solid #000000;
padding: 8px;
background-color: #ffffff;
color: #000000;
font-family: Tahoma;
font-size: 10pt;
}
.playerRankingsColumnHeader
{
font-weight: bold;
padding-left: 5px;
padding-right: 5px;
white-space: nowrap;
}
.playerRankingsColumn
{
padding-left: 5px;
padding-right: 5px;
white-space: nowrap;
}
.odd
{
}
.even
{
background-color: #eeeeee;
}
</style>
<script>
var TDSort = (function()
{
// the column index on which we are sorting
var sortIndex = -1;
// was the last sort a reverse sort?
var reverseSort = false;
// not going to try too hard for browser compatibility - just check for IE or non-IE
var mTextKey = document.all ? "innerText" : "textContent";
var mTableID = "";
var mHeaderRowID = "";
var mData = <playerdata>;
var mIndexCol = -1;
// initialize the page
function init(inTableID, inHeaderRowID)
{
mTableID = inTableID;
mHeaderRowID = inHeaderRowID;
// set the "Index" column
if(mData.length > 0)
{
for(var i=0, iLen = mData[0].length; i < iLen; i++)
{
if(mData[0][i]["IsIndex"])
mIndexCol = i;
}
}
// install an onClick handler for each column header
var theRow = document.getElementById(mHeaderRowID);
var getSortFn = function(inIndex) { return function() { sortByColumn(inIndex); }; }
if(theRow)
{
for(var i=0, iLen = theRow.cells.length; i < iLen; i++)
{
if(i != mIndexCol)
{
theRow.cells[i].onclick = getSortFn(i);
theRow.cells[i].style.cursor = "pointer";
}
}
}
// put a reference to each row in the data, if we haven't already
var theRows = document.getElementById(mTableID).rows;
for(var i=0, iLen = mData.length; i < iLen; i++)
mData[i].Row = theRows[i + 1];
}
// sort fn
function sortRow(a, b)
{
var aVal = a[sortIndex].SortValue;
var bVal = b[sortIndex].SortValue;
if((aVal === null) || (bVal === null))
{
// for equal values, fall back on the row index
if(aVal === bVal)
return a[0].Index - b[0].Index;
return aVal === null ? -1 : 1;
}
if(aVal < bVal)
return -1;
else if(aVal > bVal)
return 1;
// for equal values, fall back on the row index
return a[0].Index - b[0].Index;
}
function sortByColumn(inIndex)
{
if(mData.length == 0)
return;
if(inIndex == sortIndex)
reverseSort = !reverseSort; // sorting the same column, again, so reverse the current sort
else
reverseSort = false; // if sorting on a new column, always reset to forward sort
sortIndex = inIndex;
var theTable = document.getElementById(mTableID);
var theParent = theTable.rows[0].parentNode;
// remove all rows, in current sort order (appears to be the fastest way)
for(var i=0, iLen = mData.length; i < iLen; i++)
theParent.removeChild(mData[i].Row);
// sort the rows
mData.sort(sortRow);
if(reverseSort)
mData.reverse();
// put the rows back in the new sorted order
// there may or may not be an empty row followed by a sum and average rows, so for an easy solution insert the
// rows before the header row, then pop the header row off and put it back in front of the first row
var theHeader = theParent.rows[0];
for(var i=0, iLen = mData.length; i < iLen; i++)
{
// set the row's class to maintain even/odd row shading
mData[i].Row.className = (i % 2) ? "odd" : "even";
theParent.insertBefore(mData[i].Row, theHeader);
}
theParent.removeChild(theHeader);
theParent.insertBefore(theHeader, mData[0].Row);
// update the index column
if(mIndexCol >= 0)
{
for(var i=0, iLen = mData.length; i < iLen; i++)
mData[i].Row.cells[mIndexCol][mTextKey] = "" + (i+1);
}
}
return {
init: init
};
}());
</script>
<body onLoad="if(TDSort) { TDSort.init('pTable', 'pColumns') }" style="background-color: #FFFFFF">
<center>
<table border="0" class="infoTable">
<tr>
<td class="eventname" align="center"><eventname></td>
</tr>
<tr>
<td class="description" align="center"><description></td>
</tr>
<tr>
<td class="league" align="center">Liga: <league></td>
</tr>
<tr>
<td class="season" align="center">Temporada: <season></td>
</tr>
<tr>
<td><hr size=1 width=80% style="color: #000000" /></td>
</tr>
<tr>
<td class="info" align="center"><players> Jogadores - <rebuys> - <addons></td>
</tr>
<tr>
<td class="info" align="center"><pot> Premiação Total - <payouts> Premiados</td>
</tr>
<tr>
<td class="info" align="center">Início: <starttime></td>
</tr>
<tr>
<td class="info" align="center">Término: <endtime></td>
</tr>
<tr>
<td class="info" align="center">Rake: <totalrake></td>
</tr>
</table>
<p>
<table id="pTable" border="0" cellspacing="0" class="playerRankingsTable">
<tr id="pColumns"><playerRankingsColumns></tr>
<playerRankingsRows>
</table>
</center>
</body>
</html>