Bug clipboard?

  • Автор темы Автор темы myndeswx
  • Дата начала Дата начала

myndeswx

Client
Регистрация
15.05.2017
Сообщения
437
Реакции
104
Баллы
43
Hello, I need to copy text from variable to clipboard as html

C#:
Развернуть Свернуть Копировать
 var textcr = project.Variables ["text"]. Value;
System.Windows.Forms.Clipboard.SetText ("textcr", System.Windows.Forms.TextDataFormat.UnicodeText);
instance.ActiveTab.KeyEvent ("v", "press", "ctrl");

Works normaly, but if I change UnicodeText to Html - nothing happens, clipboard is empty
This does not work -

C#:
Развернуть Свернуть Копировать
var textcr = project.Variables ["text"]. Value;
System.Windows.Forms.Clipboard.SetText ("textcr", System.Windows.Forms.TextDataFormat.Html);
instance.ActiveTab.KeyEvent ("v", "press", "ctrl");
 
you need the correct data format

C#:
Развернуть Свернуть Копировать
var textcr = project.Variables["text"].Value;
System.Windows.Forms.Clipboard.SetText (textcr, System.Windows.Forms.TextDataFormat.Html);

75407


HTML:
Развернуть Свернуть Копировать
<html>
<body>
<!--StartFragment--><span style="color: rgb(23, 23, 23); font-family: &quot;Segoe UI&quot;, SegoeUI, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">примере демонстрируе</span><!--EndFragment-->
</body>
</html>

примере демонстрируе
 
  • Спасибо
Реакции: catol и myndeswx
you need the correct data format

C#:
Развернуть Свернуть Копировать
var textcr = project.Variables["text"].Value;
System.Windows.Forms.Clipboard.SetText (textcr, System.Windows.Forms.TextDataFormat.Html);

Посмотреть вложение 75407

HTML:
Развернуть Свернуть Копировать
<html>
<body>
<!--StartFragment--><span style="color: rgb(23, 23, 23); font-family: &quot;Segoe UI&quot;, SegoeUI, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">примере демонстрируе</span><!--EndFragment-->
</body>
</html>

примере демонстрируе
Thank you, but have you tried if it works? After action executes go to notepad or anywhere in zennoposter and try to paste it, for me - it's empty
Nevermind, it is only empty for notepad/zenno, but you can paste it in WYSIWYG editor, works like a charm, thank you.
 
Последнее редактирование:
Thank you, but have you tried if it works? After action executes go to notepad or anywhere in zennoposter and try to paste it, for me - it's empty
it will be empty, because you need to insert it in special places where html is understood. for example, the response field in this forum. If it is necessary to insert as text, then, accordingly, it is necessary to insert as text in the clipboard. A normal copy operation in the system copies several types of data at the same time, and you can also insert them in several ways.

75408
 
  • Спасибо
Реакции: myndeswx
here is an example of inserting 2 different data to the clipboard at the same time

75411


C#:
Развернуть Свернуть Копировать
System.Windows.Forms.DataObject myDataObject = new System.Windows.Forms.DataObject();
myDataObject.SetData(System.Windows.Forms.DataFormats.UnicodeText,true, "My Unicode data");
myDataObject.SetData(System.Windows.Forms.DataFormats.Html,true, project.Variables["text"].Value );
System.Windows.Forms.Clipboard.SetDataObject(myDataObject,true);
HTML:
Развернуть Свернуть Копировать
<html>
<body>
<span> this html test </span>
</body>
</html>

75412
 

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)