控件不支持RTF编辑 [英] Control not supporting rich text editing

查看:90
本文介绍了控件不支持RTF编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Outlook加载项,当用户单击加载项"按钮时,邮件正文的内容将存储在控件中.之后,控件应具有编辑内容的功能.我为此使用WinForm.

我尝试对Winforms使用以下Rich Text Editor控件:

https://yarte.codeplex.com/

具有HTML输出的基于Windows Forms的文本编辑器

我尝试通过以下方式访问邮件正文:

I am developing an Outlook AddIn where content of a mail body will be stored in a control when user clicks on the AddIn button. After that the control should have capability to edit the content. I am using WinForm for this.

I tried using the following Rich Text Editor control for winforms:

https://yarte.codeplex.com/

A Windows Forms based text editor with HTML output

I tried to access the mail body in following way:

Outlook.Application oApp = new Outlook.Application();
Outlook.Explorer oExplorer = oApp.ActiveExplorer();
Outlook.Selection oSelection = oExplorer.Selection;

foreach (object item in oSelection)
{
    Outlook.MailItem oldMailItem = (Outlook.MailItem)item;
    //This is YARTE Control
    htmlEditor1.Html = oldMailItem.HTMLBody;

    //Other Control
    editor1.BodyHtml = oldMailItem.HTMLBody;
}



当我尝试编辑控件的内容(更改字体,大小,颜色等)时,如果邮件正文包含纯文本,则效果很好.但是当邮件正文具有格式文本(彩色,不同字体)时,控件的内容将无法正确编辑.

我想念什么吗?

还是有其他控件可以满足我的要求?



When I try to edit the content of control(to change font,size,color etc.),it works fine if the mail body contains plain text. but when the mailbody has rich text (colored, different font), the content of the control is not edited properly.

Am I missing something ?

Or is there any other control which will accomplish my requirement ?

推荐答案

是什么让您认为HTML和RTF是同一件事?他们甚至都没有接近!
从电子邮件中读取的内容特别是HTML,因此您需要检查引用的控件对此进行的操作.

因此,请问编写它们的人.
对于CP文章,在底部有一个消息区域,可直接与作者对话.在这里发帖依靠他来",并意识到这是给他的.
在另一种情况下,则需要以其他方式联系作者:我们甚至都不知道他是否是该网站的成员!
What makes you think that HTML and RTF are the same thing? They aren''t even close!
And what you are reading from the email message is specifically the HTML - so you need to check what the controls you reference are doing with that.

So ask the people who wrote them.
In the case of the CP article, there is a message area at the bottom which talks direct to the author. Posting here relies on him "dropping by" and realizing that it''s for him.
In the other case, then you need to contact the author some other way: we don''t even know if he is a member of this site!


首先,请确保它是'没有外部依赖性(CSS,JavaScript库等)的真正的HTML",我将其粘贴到文件中,将扩展名设置为.html,并查看是否有任何标准浏览器将其打开并显示您期望它会出现.如果失败,我将开始研究这种格式的示例电子邮件正文,并查找任何怪异"……但是,您可能已经这样做了.

假设这不会带给您任何见解:建议您从研究Outlook电子邮件的格式开始,并注意:
First, to make sure it''s "real raw HTML" with no external dependencies (CSS, JavaScript libraries, etc.), I''d stick it in a file, set the extension to .html, and see if any standard browser will open it and display it as you expect it should appear. If that fails, I''d start studying a sample e-mail message body in that format, and look for any "weirdness" ... however, you may have already done that.

Assuming that doesn''t lead you to any insights: I suggest you start by studying the format of Outlook E-mail messages, taking note that:
报价:

所有电子邮件应用程序都不一样,因此您需要使用收件人的应用程序支持的消息格式. Microsoft Outlook提供了您在不同情况下所需的邮件格式的灵活性.您选择的邮件格式确定是否可以添加带格式的文本(例如,粗体,彩色字体和项目符号),以及是否可以将图片添加到邮件正文. 但是,仅因为您选择了一种可以添加这些功能的邮件格式,并不意味着收件人将能够看到它们.那是因为某些电子邮件应用程序不支持格式化的消息或图片.

All e-mail applications are not alike, so you need to use a message format that your recipient''s application supports. Microsoft Outlook offers the flexibility in message formats that you need for different situations. The message format that you choose determines whether you can add formatted text, such as bold fonts, colored fonts, and bullets, and whether you can add pictures to the message body. However, just because you choose a message format that lets you add these features doesn''t mean the recipient will be able to see them. That is because some e-mail applications don''t support formatted messages or pictures.

[

[^]

If you finally end up rather certain the problem is located in some flaw in the Controls you are using: then take OriginalGriff''s excellent advice and contact the authors of the Control(s) you use, and report what you found.


这篇关于控件不支持RTF编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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