my code is
StringBuilder sb = new StringBuilder();
sb.Append("<table border="1">");
sb.Append("<tr>");
sb.Append("</tr>");
foreach (DataGridViewRow row in dgv.Rows)
{
foreach (DataGridViewCell cell in row.Cells)
{
sb.AppendFormat("<tr>");
sb.AppendFormat("<td>");
sb.Append(cell.Value);
sb.AppendFormat("</td>");
sb.AppendFormat("</tr>");
} } sb.Append("</table>"); return sb.ToString();