Murray Brown
asked on
ASP.net use VB.net to construct spaced html body of email
Hi. I want to use the type of VB.net code below to contruct the Purchase Order shown further on. This is for the body of an email.
As you can see I have used an html table for spacing. How should I approach this? Is there perhaps a better way to do this without a table?
As you can see I have used an html table for spacing. How should I approach this? Is there perhaps a better way to do this without a table?
Dim oHBody As String = ""
oHBody = oHBody & "<html><body><font size=3 color=" & sColor1 & " name = 'Calibri'>" & oIntro & "</font></body></html>"
oHBody = oHBody & "<br>"
oHBody = oHBody & "<html><body><font size=3 color=" & sColor2 & " name = 'Calibri'>" & sDate & "</font></body></html>"
oHBody = oHBody & "<br>"
<table>
<tr>
<td>
<asp:Label ID="lblBuyerCompanyName" runat="server" Font-Size="X-Large"></asp:Label>
</td>
<td></td>
<td>
<asp:Label ID="lblSpacer" runat="server" Width="100px"></asp:Label>
</td>
<td>
<asp:Label ID="Label21" runat="server" Font-Bold="True" Text="PURCHASE ORDER" Font-Size="X-Large"></asp:Label>
</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>
<asp:Image ID="Image1" runat="server" Height="110px" Width="209px" />
</td>
<td>
</td>
<td></td>
<td>
</td>
<td>
</td>
<td>
</td>
<td></td>
</tr>
<tr>
<td>
<asp:Label ID="lblBuyerAddress1" runat="server"></asp:Label>
</td>
<td></td>
<td>
<asp:Label ID="Label16" runat="server" Text="Company Reg No: "></asp:Label>
</td>
<td>
<asp:Label ID="lblCompanyReg" runat="server"></asp:Label>
</td>
<td></td>
<td>
<asp:Label ID="Label22" runat="server" Text="Date"></asp:Label>
</td>
<td></td>
</tr>
<tr>
<td>
<asp:Label ID="lblBuyerAddress2" runat="server"></asp:Label>
</td>
<td></td>
<td>
<asp:Label ID="Label17" runat="server" Text="Vat No:"></asp:Label>
</td>
<td>
<asp:Label ID="lblVATNumber" runat="server"></asp:Label>
</td>
<td></td>
<td>
<asp:Label ID="lblDate" runat="server"></asp:Label>
</td>
<td></td>
</tr>
<tr>
<td>
<asp:Label ID="lblBuyerAddress3" runat="server"></asp:Label>
</td>
<td></td>
<td>
<asp:Label ID="Label18" runat="server" Text="Tel No:"></asp:Label>
</td>
<td class="auto-style2">
<asp:Label ID="lblTelephoneNumber" runat="server"></asp:Label>
</td>
<td class="auto-style2"></td>
<td class="auto-style2">
<asp:Label ID="Label24" runat="server" Text="Document No"></asp:Label>
</td>
<td class="auto-style2"></td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="lblBuyerAddress4" runat="server"></asp:Label>
</td>
<td class="auto-style2"></td>
<td>
<asp:Label ID="Label19" runat="server" Text="Email: "></asp:Label>
</td>
<td class="auto-style2">
<asp:Label ID="lblEmail" runat="server"></asp:Label>
</td>
<td class="auto-style2"></td>
<td class="auto-style2">
<asp:Label ID="lblDocumentNo" runat="server"></asp:Label>
</td>
<td class="auto-style2"></td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="lblBuyerAddress5" runat="server"></asp:Label>
</td>
<td class="auto-style2">
</td>
<td></td>
<td class="auto-style2">
</td>
<td class="auto-style2"></td>
<td class="auto-style2">
</td>
<td class="auto-style2"></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>
<asp:Label ID="Label32" runat="server" Text="To: "></asp:Label>
<asp:Label ID="lblSellerName" runat="server"></asp:Label>
</td>
<td>
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label31" runat="server" Text="Attention: "></asp:Label>
<asp:Label ID="lblAttention" runat="server"></asp:Label>
</td>
<td> </td>
<td></td>
<td>
<asp:Label ID="lblDeliverToHeader" runat="server">Deliver To:</asp:Label>
</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>
<asp:Label ID="lblSellerAddress1" runat="server"></asp:Label>
</td>
<td></td>
<td></td>
<td>
<asp:Label ID="lblShipAddress1" runat="server" Width="200px"></asp:Label>
</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>
<asp:Label ID="lblSellerAddress2" runat="server"></asp:Label>
</td>
<td></td>
<td></td>
<td>
<asp:Label ID="lblShipAddress2" runat="server" Width="200px"></asp:Label>
</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>
<asp:Label ID="lblSellerAddress3" runat="server"></asp:Label>
</td>
<td></td>
<td></td>
<td>
<asp:Label ID="lblShipAddress3" runat="server" Width="200px"></asp:Label>
</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>
<asp:Label ID="lblSellerAddress4" runat="server"></asp:Label>
</td>
<td></td>
<td></td>
<td>
<asp:Label ID="lblShipAddress4" runat="server" Width="200px"></asp:Label>
</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>
<asp:Label ID="lblSellerAddress5" runat="server"></asp:Label>
</td>
<td></td>
<td></td>
<td>
<asp:Label ID="lblShipAddress5" runat="server" Width="200px"></asp:Label>
</td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
ASKER
Thanks. How do I construct an html table using my VB.net, something like oHBody = oHBody & "<table><tr>"
as a common practice (and I guess I mentioned in your another question before), I wouldn't put the whole HTML into a String variable. Instead, I will store the HTML as a physical file and load it when necessary.
you can check and compare the methods to read a file content here
What's the fastest way to read a text file line-by-line?
https://stackoverflow.com/questions/8037070/whats-the-fastest-way-to-read-a-text-file-line-by-line
you can check and compare the methods to read a file content here
What's the fastest way to read a text file line-by-line?
https://stackoverflow.com/questions/8037070/whats-the-fastest-way-to-read-a-text-file-line-by-line
ASKER
thanks. I understand. I just need example code for doing that for a table
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great! Thanks very much
ASKER
Ryan thanks again. That worked out perfectly! Really great answer
coool great
Or if you want to have a physical file (like PDF), then you probably need to create a "template file", merge with the data and then generate the final output file accordingly