Bug clipboard?

myndeswx

Client
Регистрация
15.05.2017
Сообщения
404
Благодарностей
90
Баллы
28
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");
 

Phoenix78

Client
Read only
Регистрация
06.11.2018
Сообщения
11 790
Благодарностей
5 690
Баллы
113
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

myndeswx

Client
Регистрация
15.05.2017
Сообщения
404
Благодарностей
90
Баллы
28
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.
 
Последнее редактирование:

Phoenix78

Client
Read only
Регистрация
06.11.2018
Сообщения
11 790
Благодарностей
5 690
Баллы
113
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

Phoenix78

Client
Read only
Регистрация
06.11.2018
Сообщения
11 790
Благодарностей
5 690
Баллы
113

Phoenix78

Client
Read only
Регистрация
06.11.2018
Сообщения
11 790
Благодарностей
5 690
Баллы
113
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
 

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