从clipobard问题中粘贴c# [英] Paste from clipobard problem c#
问题描述
嗨!
我仍在使用outlook myappointment.RTFBODY方法...
我在某些页面上发现有一个workround会给我一个将html文本放在那里的可能性......
我已经尝试过了,它已经尝试了 - 几乎......
webBrowser.CreateControl();
webBrowser.DocumentText = html; // HTML = HTML CODE
Application.DoEvents();
webBrowser.Document.ExecCommand( SelectAll, false , null );
webBrowser.Document.ExecCommand( Copy, false , null );
RichTextBox testbox = new RichTextBox();
testbox.Paste(); // 问题在这里
问题是.Paste()方法粘贴所有内容而不进行格式化(没有颜色,图片 - 只是文本+表格)
我需要使用粘贴,同时保持格式化,这是可用的在每个M $前卫..
仍然。我不知道怎么用C#
请帮忙!
prog ..
仍然。我不知道怎么用C#
请帮忙!
你试过吗?
testbox.Text = Clipboard.GetText(TextDataFormat.Rtf);
OR
DataFormats.Format myFormat = DataFormats.GetFormat(DataFormats.Html);
if(testbox.CanPaste( myFormat))
{
richTextBox1.Paste(myFormat);
返回true;
}
testbox.selectedRtf = Clipboard.GetData(DataFormats.Rtf).ToString();
Hi!
I am still fighting with outlook myappointment.RTFBODY method...
I have found on some page that there is a workround which will give me a possibility to put there html text...
I have tried it, and it wokrs - almost...
webBrowser.CreateControl();
webBrowser.DocumentText = html; // HTML = HTML CODE
Application.DoEvents();
webBrowser.Document.ExecCommand("SelectAll", false, null);
webBrowser.Document.ExecCommand("Copy", false, null);
RichTextBox testbox = new RichTextBox();
testbox.Paste(); // PROBLEM LIES HERE
The problem is that .Paste() method paste everything without formating (no colors, pictures - just text + tables)
I need use "paste while maintaining formatting" which is available in every M$ prog..
Still. I dont know how to do that in C#
Please help!
prog..
Still. I dont know how to do that in C#
Please help!
Did you try these?
testbox.Text = Clipboard.GetText(TextDataFormat.Rtf);
OR
DataFormats.Format myFormat = DataFormats.GetFormat(DataFormats.Html);
if(testbox.CanPaste(myFormat))
{
richTextBox1.Paste(myFormat);
return true;
}
OR
testbox.selectedRtf=Clipboard.GetData(DataFormats.Rtf).ToString();
这篇关于从clipobard问题中粘贴c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!