RTF转换为HTML(格式化的HTML代码) [英] RTF to HTML (formatted HTML code)

查看:381
本文介绍了RTF转换为HTML(格式化的HTML代码)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

我已经在vb.net,.net 4框架中开发了一个小的smtp Windows应用程序.我已阅读以下文章如何通过VB.NET或C#从GMAIL帐户发送邮件. Windows编程,具有一定的自定义功能 [ ^ ],带有一些自定义[^],并使用代码片段来获取程序的主要功能.

我遇到的一个问题是,我一直在网上搜索很多地方而没有运气,是我在使用Richtextbox作为主要消息文本框(txtmessge),但是当我在HTML视图中发送消息时,它不保留格式设置属性,是否可以在richtextbox中以格式化的格式发送消息.

我复习了许多文章,但没有找到合适的代码,它们似乎都引发了格式问题.

轻松地在VB.NET中将RTF转换为HTML [

Hi Everyone.

I have been developed a small smtp Windows application in vb.net, .net 4 framework. ihave read the following article How to Send Mails from your GMAIL Account through VB.NET or C#. Windows Programming, with a Bit of Customization[^], with a Bit of Customization[^] and used snippets of codes to get the main funcationality of the program.

An issue I am stuck with and I have searched multple places on the net with no luck, is I am using a richtextbox for the main message text box (txtmessge) but when I send the message in HTML view, it doesnt retain the formatting properties, is it achievable to have a message sent as it formatted in the richtextbox.

I have review many article with no success of an apporiate code they all seem to raise formatting issues.

Converting RTF to HTML in VB.NET the Easy Way[^]

And after previous post, Simon has informed me that Outlook 2007 on has changed its way it reads stylesheets.

Also be aware that outlook 2007 onwards has changed the ways that it reads HTML emails.

you will need to embed images rather than add them as HTML tag. Also they have changed the way that it reads StyleSheets.

microsoft breaks html email rendering in outlook[^]


I believe this is where the issue alies in the code:

Dim htmlview As String
      Dim messagebyuser As String = txtmessage.Text
      Dim locateS As String = "C:\logo.jpg"
 htmlview = messagebyuser


还是我必须将消息构建为html结构?

任何帮助都会得到解决. =)


or will I have to build the message into a html structure?

any help would be appericated. =)

推荐答案

看看 HTML电子邮件 [ ^ ]上的维基百科.

轻松地在VB.NET中将RTF转换为HTML [ DevExpress Rich Text Editor [文本对象模型 [
Take a look at HTML e-mail[^] on wikipedia.

Converting RTF to HTML in VB.NET the Easy Way[^] requires word to be installed on the computer, and if that''s a requirement - I''d just drop the rtf editor and use word directly - possibly embeding it inside the application as a control.

Basically you message will have to be rendered as HTML, preferably referencing nothing that''s not part of the message for rendering purposes.

You could do worse than using DevExpress Rich Text Editor[^] as a replacement for the standard .Net rtf editor - it knows about html.

If you want to keep on using the standard .Net rtf editor - you''ll be able to access the
Text Object Model[^], and can roll your own html exporter using this unmanaged API.

If you don''t have a lot of time on your hands, shopping around for an existing solution would probably be the best way to solve your problem.

Regards
Espen Harlinn


这篇关于RTF转换为HTML(格式化的HTML代码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆