问题描述
我正在发送自动生成的电子邮件报告,因此我使用XElements生成了一个正文.电子邮件发送部分工作正常,我只想预览电子邮件,然后再发送出去.
我无法在WebBrowser控件中显示XElement.
这是我的尝试,但显示不正确.
Hi,
I''m sending Auto Generated Email Reports, so I generate a Body using XElements. The emailing part works fine, I would just like to preview the email before sending it out.
I''m having trouble displaying the XElement in the WebBrowser Controll.
This is my attempt, but its displayed incorrectly.
Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
Dim Body As XElement
Body = <HTML>
<BODY>
<B>Test</B>
<BR>Line1</BR>
<BR>Line2</BR>
<BR>Line3</BR>
</BODY>
</HTML>
WebBrowser1.DocumentText = Body.ToString
Emailer.Send(txtTo.Text, txtSubject.Text, Body)
End Sub
由于某种原因,它会使WebBrowser控件上的空格增加一倍.但是在电子邮件上,它的罚款:困惑:
WebBroweser将显示以下内容:
测试
Line1
Line2
Line3
电子邮件显示在哪里:
测试
Line1
Line2
Line3
任何想法我在这里做错了吗?
For some reason it double spaces on WebBrowser Control. But on the email its fine:confused:
The WebBroweser displayes this:
Test
Line1
Line2
Line3
Where as the Email displayes this:
Test
Line1
Line2
Line3
Any Idea what I''m doing wrong here?
推荐答案
<HTML>
<BODY>
<B>Test</B><BR/>
Line1<BR/>
Line2<BR/>
Line3<BR/>
</BODY>
</HTML>
在html和xhtml上阅读有关"br"标签的更多信息:
http://www.w3schools.com/tags/tag_br.asp [ ^ ]
Read more about "br" tag in html and xhtml on:
http://www.w3schools.com/tags/tag_br.asp[^]
这篇关于在WebBrowser控件中显示XElement的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!