Topic: Problem converting tablegrid to HTML for Emailing
I'm trying to take the contents of a tablegrid and convert it to HTML for the body of an email.
My problem is that I only seem to get one complete row and the first two columns into the second row into HTML.
I'm practising with a tablegrid that has four columns and five rows.
The code I'm using is below
sList:TstringList;
begin
sList:=TStringList.Create;
sList.Add('<html>');
sList.Add('<head>');
sList.add('<style>');
sList.Add('table, th, td {');
sList.Add(' border: 1px solid #dddddd; text-align: left; padding: 8px');
sList.Add('}');
sList.Add('</style>');
sList.add('</head>');
sList.Add('<body>');
sList.Add('<table>');
sList.Add('<tr><th>BSuite#:</th>'+ '<th>Part Number</th>' + '<th>Description'+ '</th>'+'<th>Qty'+'</th></tr>');
for indx := 0 to frmEmail.tgEmailList.RowCount-1 do
begin
sList.Add('<tr><td>'+frmEmail.tgEmailList.Cells[0,indx] + '</td>' + '<td>' +frmEmail.tgEmailList.Cells[1,indx] +'</td>'+'<td>'+frmEmail.tgEmailList.Cells[2,indx]+'</td>'+'<td>'+frmEmail.tgEmailList.Cells[3,indx]+'</td></tr>');
end;
sList.Add('</table>');
sList.Add('</body>');
sList.Add('</html>');
openURL('mailto:'+frmEmail.cmbEmailAddress.Text+'?subject='+frmEmail.cmbSupplierList.Text+'Order'+'&Body='+sList.text);
sList.Free;
I'm just not seeing why I'm only getting 1 and a bit rows. This will be going into Outlook, but my personal email client (emClient) has to have the HTML input manually. My suspicion is that I'm missing an HTML tag, but I can't see where!
Any thoughts gratefully received.