[英]Pasting clipboard content in webbrowser component
i wrote a small application that will monitor the clipboard and paste text directly in a webbrowser component. 我写了一个小应用程序,它将监视剪贴板并将文本直接粘贴到Webbrowser组件中。
...
DocumentWysiwyg = ClipBoardWebBrowser.Document.DomDocument as IHTMLDocument2;
DocumentWysiwyg.designMode = "On";
...
and when the Clipboard changes, i paste the Clipboard content into the webbrowser using: 当剪贴板更改时,我使用以下命令将剪贴板内容粘贴到Web浏览器中:
ClipBoardWebBrowser.Document.Write(Clipboard.GetText(TextDataFormat.Html));
now, when pasting any copied content from web as html, i get inside the html 现在,当从网络粘贴任何复制的内容作为html时,我进入html内
span class="Apple-converted-space">Â </span
which does not belong to the html i copied from a website. 这不属于我从网站复制的HTML。
what are those? 那些是什么? and how can i get rid of them?
我该如何摆脱它们? any help is really appreciated .
任何帮助都非常感谢。
here is the html code for google.de as example http://pastie.org/pastes/3706386/text 这是google.de的html代码,例如http://pastie.org/pastes/3706386/text
how would i make sure that the pasted clipboard is exactly the same as the copied data in the clipboard? 我如何确保粘贴的剪贴板与剪贴板中复制的数据完全相同?
On Mac multiple occurrences of a regular space " " get converted such that they replace every other regular space with a non-breaking space character aka This allows the spaces to still break on every other character, but preserve such ranges of spaces. 在Mac上,多次出现的常规空格会被转换,以使它们用不间断的空格字符替换其他所有常规空格,这也使空格在其他每个字符上仍会中断,但是保留了这样的空格范围。
The reason for this is because without this trick HTML would compress multiple spaces to a single one. 这样做的原因是因为没有这种技巧,HTML会将多个空间压缩为单个空间。 Having only characters would disable line wrapping, because as their name states they would be non-breaking.
仅使用字符会禁用换行,因为如其名称所述,它们将是不间断的。
In addition to "Apple-converted-space" there was also "Apple-style-span" but that was eliminated from Webkit in 2011: https://www.webkit.org/blog/1737/apple-style-span-is-gone/ 除了“ Apple转换空间”外,还有“ Apple风格的跨度”,但在2011年从Webkit中删除了: https : //www.webkit.org/blog/1737/apple-style-span-is -去/
So to answer your question: since Webkit is filling the pasteboard you cannot do anything to prevent such behavior. 因此,请回答您的问题:由于Webkit正在填充粘贴板,因此您无法采取任何措施来防止此类行为。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.