CutCopyDragWithHtml doesn't create correct data

SyntaxEditor for Windows Forms Forum

Posted 11 years ago by Jeff Pek - Autodesk, Inc.
Version: 4.0.0271
Platform: Services
Environment: Windows XP (32-bit)
Avatar
When we use a SyntaxEditor control, and set its CutCopyDragWithHtml property to True, we're finding that the HTML clipboard content that it generates is incomplete -- i.e., only a fragment of HTML. For example:

<span style="color: #0000FF;">using</span><span style="color: #000000;"> System;
</span><span style="color: #0000FF;">using</span><span style="color: #000000;"> System.Collections.Generic;
</span>

This causes problems with applications such as OneNote that want to paste HTML. It winds up pasting nothing (at least it looks like nothing).

According to MSDN (http://msdn.microsoft.com/en-us/library/ms649015(VS.85).aspx), it would seem that only having this "little piece" of HTML is not correct.

It seems that you need the other HTML "structure" wrapping this fragment.

Comments (4)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
So really if we wrapped it with:
<html><body>...what is currently copied...</body></html>
then it would be ok, right?


Actipro Software Support

Posted 11 years ago by Jeff Pek - Autodesk, Inc.
Avatar
No, I don't think that would work. You need more than that. See: http://blogs.msdn.com/jmstall/archive/2007/01/21/html-clipboard.aspx

For example, if you look at what OneNote itself generates on the clipboard for a small selection, you'll see this:

Version:1.0
StartHTML:0000000105
EndHTML:0000000755
StartFragment:0000000482
EndFragment:0000000715

<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=OneNote.File>
<meta name=Generator content="Microsoft OneNote 12">
</head>

<body lang=en-US>


<p style='margin:0in;font-family:"Courier New";font-size:10.0pt'><span
style='color:blue'>Child</span><span style='color:black'> bv1 </span><span
style='color:blue'>As</span><span style='color:black'> :IvBaseView</span></p>


</body>

</html>

Note that the blog post cited also contains some sample code to help produce an appropriate clipboard text string given a fragment.

Jeff
Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Ok, this is now fixed for the next maintenance release.


Actipro Software Support

Posted 11 years ago by Jeff Pek - Autodesk, Inc.
Avatar
Super! That was fast!
But ... I have 2 more issues with the HTML clipboard data that I'll post shortly.

Thanks for the fast work!
Jeff
The latest build of this product (v2018.1 build 0341) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.