private bool ExportTablePointsAsHTML(string path)
{
StringBuilder strBuilder = new StringBuilder();
strBuilder.AppendLine("<style type=\"text/css\">");
strBuilder.AppendLine("table {vertical-align: middle}");
strBuilder.AppendLine("thead {border:solid 2px; border-color:black}");
strBuilder.AppendLine("tr {background-color:#fff;}");
strBuilder.AppendLine("tr:hover {background-color:#efefef;}");
strBuilder.AppendLine("th {padding: 2px 6px 2px 6px;}");
strBuilder.AppendLine("td {padding: 2px 6px 2px 6px;} ");
strBuilder.AppendLine("</style>");
strBuilder.AppendLine("<table rules=\"cols\" border=\"1\">");
strBuilder.AppendLine("<thead>");
strBuilder.AppendLine("<tr>");
strBuilder.AppendLine(" <th>#</th>");
strBuilder.AppendLine(string.Format(" <th>{0}</th>", StringTable.MainWindow_Gracz));
strBuilder.AppendLine(" <th>CID</th>");
strBuilder.AppendLine(" <th>RID</th>");
strBuilder.AppendLine(string.Format(" <th>{0}</th>", StringTable.MainWindow_LG));
strBuilder.AppendLine(string.Format(" <th>{0}</th>", StringTable.MainWindow_Punkty));
strBuilder.AppendLine(string.Format(" <th>{0}</th>", StringTable.MainWindow_B));
strBuilder.AppendLine(" <th>+/-</th>");
strBuilder.AppendLine(string.Format(" <th>{0}</th>", StringTable.MainWindow_WRP));
strBuilder.AppendLine("</tr>");
strBuilder.AppendLine("</thead>");
strBuilder.AppendLine("<tbody>");
foreach (Player player in this.tournament.PointsTable.OrderBy(p => p.Place))
{
string name = string.Format("{0} '{1}' {2}", player.Name, player.Alias, player.Surname);
if (name.Length > 33) name = name.Substring(0, 33);
string corpoID = string.IsNullOrEmpty(player.CorpoIdentity) ? "" : player.CorpoIdentity;
string runnerID = string.IsNullOrEmpty(player.RunnerIdentity) ? "" : player.RunnerIdentity;
strBuilder.AppendLine("<tr>");
strBuilder.AppendLine(string.Format(" <td align=\"center\">{0}</td>", player.Place.ToString()));
strBuilder.AppendLine(string.Format(" <td>{0}</td>", name));
strBuilder.AppendLine(string.Format(" <td>{0}</td>", corpoID));
strBuilder.AppendLine(string.Format(" <td>{0}</td>", runnerID));
strBuilder.AppendLine(string.Format(" <td align=\"center\">{0}</td>", player.GamesCount.ToString()));
strBuilder.AppendLine(string.Format(" <td align=\"center\">{0}</td>", player.Points));
strBuilder.AppendLine(string.Format(" <td align=\"center\">{0}</td>", player.Sos.ToString()));
strBuilder.AppendLine(string.Format(" <td align=\"center\">{0}</td>", player.SmallPointsPlusMinus));
strBuilder.AppendLine(string.Format(" <td align=\"center\">{0}</td>", player.GamesWinDrawLoose));
strBuilder.AppendLine("</tr>");
}
strBuilder.AppendLine("</tbody>");
strBuilder.AppendLine("</table>");
using (StreamWriter outfile = new StreamWriter(new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite), Encoding.UTF8))
{
outfile.Write(strBuilder.ToString());
}
return true;
}