How to format data with HTML tag?

0 votes
asked by about Spire.Office Community Edition
edited by

        sb.Append("<html>");
        sb.AppendFormat("<body>");
       sb.AppendFormat("<table>");
        sb.AppendFormat("<tr>");
        foreach (DataGridViewColumn column in dgv.Columns)
        {
          sb.AppendFormat("<th>");
           sb.AppendFormat(column.Name);
           sb.AppendFormat("</th>");
        }
        sb.AppendFormat("</tr>");
        sb.AppendFormat("<tr>");
        foreach (DataGridViewRow row in dgv.Rows)
        {

            foreach (DataGridViewCell cell in row.Cells)
            {
                sb.AppendFormat("<td>");
                sb.Append(cell.Value);
                sb.AppendFormat("</td>");
            }
        }
        sb.AppendFormat("</tr>");
        sb.AppendFormat("</table>");
        sb.AppendFormat("</body>");
        sb.Append("</html>");
         return sb.ToString();

1 Answer

0 votes
No avatar answered by (329k points)

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register
...