CutCopyDragWithHtml doesn't include font information

SyntaxEditor for Windows Forms Forum

Posted 16 years ago by Jeff Pek - Autodesk, Inc.
Version: 4.0.0271
Platform: .NET 2.0
Environment: Windows XP (32-bit)
Avatar
The HTML data placed on the clipboard when doing a copy operation from SyntaxEditor doesn't include font information. So, when it's copied into an HTML-based viewer (like OneNote), you just get OneNote's default font instead of the font that was applied to the text in SE.

I think it would make sense to include the font information.

Comments (5)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I tried specifying the font info in a style attribute but OneNote doesnt seem to pay attention to it and just uses its default font family and size.


Actipro Software Support

Posted 16 years ago by Jeff Pek - Autodesk, Inc.
Avatar
I don't think that's true, as I can paste stuff in from IE and get the correct font to be used. Here's an example that worked fine -- this is the text from the clipboard. This is the site: http://www.dexterlittleleague.com/

Thanks,
Jeff

Version:1.0
StartHTML:000000214
EndHTML:000003018
StartFragment:000001741
EndFragment:000002909
StartSelection:000001741
EndSelection:000002905
SourceURL:http://www.eteamz.com/dexterlittleleague/index.cfm?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML
xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>Dexter Little League</TITLE>
<SCRIPT type=text/javascript>
var site = 2142845;
</SCRIPT>
<LINK media=all href="/z/stylesheets/sites/master.css" type=text/css
rel=stylesheet><LINK media=all href="/z/stylesheets/sites/llb_baseball.css"
type=text/css rel=stylesheet>
<STYLE type=text/css>
body {
color: #000000;
}
a {
color: #0000FF;
}
a:visited {
color: #6741A3;
}
a:active {
color: #A063EC;
}
</STYLE>

<SCRIPT src="/z/sitez/main/lib.js" type=text/javascript></SCRIPT>

<SCRIPT src="/z/javascript/embedControls.js" type=text/javascript></SCRIPT>

<SCRIPT src="/z/javascript/prototype.js" type=text/javascript></SCRIPT>

<SCRIPT src="/z/javascript/effects.js" type=text/javascript></SCRIPT>

<SCRIPT type=text/javascript>

function DownloadFile(file_id) {
PopDownload=window.open('/admin/sitez/download.cfm?id='+file_id+'&amp;site=2142845','DownloadWindow','scrollbars,width=800,height=300');
PopDownload.focus();
}

var site = 2142845;
</SCRIPT>

<SCRIPT type=text/javascript>
var z = ' ';
</SCRIPT>
</HEAD>

<BODY>

<DIV id=site_wrapper>

<DIV id=site_body_wrapper>

<DIV id=site_body>

<DIV id=site_content_wrapper>

<DIV id=site_content>

<DIV id=main_content>

<DIV id=content_wrapper>

<DIV id=content>
<FONT face="Comic Sans MS" size=2><P align=center><FONT color=#ffffff><SPAN
style="FONT-SIZE: 24pt; COLOR: #ff6600; FONT-FAMILY: Verdana">VOLUNTEER LABOR
NEEDED FOR </SPAN>
<SPAN
style="FONT-SIZE: 24pt; COLOR: #ff6600; FONT-FAMILY: Verdana">TYLER</SPAN>
<SPAN
style="FONT-SIZE: 24pt; COLOR: #ff6600; FONT-FAMILY: Verdana"> STEFFEY
FIELDS</SPAN>
</FONT> </P>
<P align=center><SPAN
style="FONT-SIZE: 20pt; COLOR: #ff6600; FONT-FAMILY: Verdana">Plans are being
made to break ground on the new Tyler Steffey<SPAN>  </SPAN>Little League Field
at </SPAN><SPAN
style="FONT-SIZE: 20pt; COLOR: #ff6600; FONT-FAMILY: Verdana">Peace</SPAN><SPAN
style="FONT-SIZE: 20pt; COLOR: #ff6600; FONT-FAMILY: Verdana"> </SPAN><SPAN
style="FONT-SIZE: 20pt; COLOR: #ff6600; FONT-FAMILY: Verdana">Lutheran</SPAN><SPAN
style="FONT-SIZE: 20pt; COLOR: #ff6600; FONT-FAMILY: Verdana"> </SPAN><SPAN
style="FONT-SIZE: 20pt; COLOR: #ff6600; FONT-FAMILY: Verdana">Church</SPAN><SPAN
style="FONT-SIZE: 20pt; COLOR: #ff6600; FONT-FAMILY: Verdana">.<SPAN> 
</SPAN>Work will begin with moving dirt, laying seed and working on an
irrigation plan.</SPAN></P></FONT>
</DIV>
</DIV>
</DIV>
</DIV>
</DIV>
</DIV>
</DIV>
</DIV>
</BODY>
</HTML>
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I've tried this over and over with no good results. I even copied the span tags right from your sample and included them around what we send with no change. I don't believe it pays attention to the font data in CF_HTML.

Also note that when you paste from IE into OneNote, it includes a thing like this at the bottom:
"Pasted from <https://www.actiprosoftware.com/Default.aspx>"

This means it uses another method when copying from IE and is not getting data from CF_HTML.


Actipro Software Support

Posted 16 years ago by Jeff Pek - Autodesk, Inc.
Avatar
I took that text (what I had pulled from the IE clipboard), and used it in the editor_CutCopyDrag event handler in your C# sample application, essentially replacing what would have gone on the clipboard for the "HTML Format" data with that exact text.

Pasting that into OneNote worked fine, including the page reference, which seems to be being grabbed from a SourceURL property.

So, there must be a little more to the picture than what you're seeing. Keep in mind that making this work requires the previous fix to get HTML Format to work at all.
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
OneNote sure seems buggy. Look at this... if I paste in this I see two different font sizes (correct):
Format:HTML Format
Version:1.0
StartHTML:     165
EndHTML:     522
StartFragment:     314
EndFragment:     490
StartSelection:     314
EndSelection:     314
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>SyntaxEditor Code Snippet</TITLE></HEAD><BODY><!--StartFragment--><p><span style="FONT-SIZE: 24pt; COLOR: #ff6600; FONT-FAMILY: Verdana">Test1</SPAN></p>
<p><span style="FONT-SIZE: 20pt; COLOR: #ff6600; FONT-FAMILY: Verdana">Test2</SPAN></p><!--EndFragment--></BODY></HTML>
If I take out the two paragraphs, it uses the default font (buggy) and ignores the spans. Same if I have one paragraph that surrounds the entire text block:
Format:HTML Format
Version:1.0
StartHTML:     165
EndHTML:     508
StartFragment:     314
EndFragment:     476
StartSelection:     314
EndSelection:     314
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>SyntaxEditor Code Snippet</TITLE></HEAD><BODY><!--StartFragment--><span style="FONT-SIZE: 24pt; COLOR: #ff6600; FONT-FAMILY: Verdana">Test1</SPAN>
<span style="FONT-SIZE: 20pt; COLOR: #ff6600; FONT-FAMILY: Verdana">Test2</SPAN><!--EndFragment--></BODY></HTML>
With this information, I'm afraid there is nothing more we can do.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.