PeterPanettone 158 Posted June 27, 2019 Configuration is: Formatted text/RTF/HTM: After pasting in WinWord 2010 it looks like this: Share this post Link to post
dummzeuch 1506 Posted June 27, 2019 (edited) I guess you mean the squares on the left hand border? (You should have said so, because i just starred at this picture for several minutes before i noticed them.) Everything else looks fine to me. Edited June 27, 2019 by dummzeuch Share this post Link to post
PeterPanettone 158 Posted June 27, 2019 2 hours ago, dummzeuch said: I guess you mean the squares on the left hand border? (You should have said so, because i just starred at this picture for several minutes before i noticed them.) Everything else looks fine to me. Yes. What are the squares doing there? Share this post Link to post
dummzeuch 1506 Posted June 28, 2019 My guess would be that these are additional line feed characters that word can't handle. But for now that's just a guess. Please file a bug report and include all files you used to create these screenshots. Share this post Link to post
dummzeuch 1506 Posted June 29, 2019 I just tried to reproduce this, but I could not. The RTF-code saved to a file looks fine to me and pasting into Wordpad and Libre Office Writer also works as expected. So this might be a MS Word specific issue. I don't own any MS Word license that I could use for the test. I tried Delphi 2007 and 10.3 since you did not mention your version. Does anybody know of a tool that can display RTF clipboard contents as text (I only found some that strip RTF formatting from the text) or do I have to write one myself? @PeterPanettone what about the bug report? Maybe it's something in your file(s) that causes the problem. Share this post Link to post
PeterPanettone 158 Posted June 29, 2019 I've tried it now with a fresh new WinWord document where I pasted the clipboard content. No squares there. Then I retried it with the document where the squares have appeared yesterday. The squares appeared again. So I have to conclude that the problem appears only in a specific WinWord document. I could not find out why. Share this post Link to post
PeterPanettone 158 Posted June 29, 2019 (edited) I have analyzed what GExperts exports as HTML clipboard format: Version:0.9 StartHTML:0000000105 EndHTML:0000002128 StartFragment:0000001413 EndFragment:0000002112 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Fragment of MainForm.pas</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="generator" content="SynEdit HTML exporter" /> <style type="text/css"> <!-- body { color: #000000; background-color: #FFFFFF; } .pas1-assembler { background-color: #FFFFFF; color: #000000; } .pas1-character { background-color: #FFFFFF; color: #0000FF; } .pas1-comment { background-color: #FFFFFF; color: #008000; font-style: italic; } .pas1-float { background-color: #FFFFFF; color: #0000FF; } .pas1-hexadecimal { background-color: #FFFFFF; color: #0000FF; } .pas1-identifier { background-color: #FFFFFF; color: #000000; } .pas1-number { background-color: #FFFFFF; color: #0000FF; } .pas1-preprocessor { background-color: #FFFFFF; color: #008000; font-style: italic; } .pas1-reservedword { background-color: #FFFFFF; color: #000080; font-weight: bold; } .pas1-space { background-color: #FFFFFF; color: #000000; } .pas1-string { background-color: #FFFFFF; color: #0000FF; } .pas1-symbol { background-color: #FFFFFF; color: #000000; } --> </style> </head> <body> <!--StartFragment--><pre><code><span class="pas1-reservedword">function</span><span class="pas1-space"> PAIsWindowMinimized(h: HWND): Boolean; </span><span class="pas1-comment">// Detects whether a window is minimized or not </span><span class="pas1-reservedword">var </span><span class="pas1-space"> wp: Winapi.Windows.WINDOWPLACEMENT; </span><span class="pas1-reservedword">begin </span><span class="pas1-space"> wp.length := SizeOf(Winapi.Windows.WINDOWPLACEMENT); Winapi.Windows.GetWindowPlacement(h, @wp); Result := wp.showCmd = Winapi.Windows.SW_SHOWMINIMIZED; </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">; </span></code></pre><!--EndFragment--></body> </html>* This is what CnWizards exports as HTML format: Version:1.0 StartHTML:000000176 EndHTML:000003298 StartFragment:000001389 EndFragment:000003263 StartSelection:000001389 EndSelection:000003263 SourceURL:http://www.cnpack.org/ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <meta name="GENERATOR" content="CnPack Source2Html Wizard (http://www.cnpack.org)"> <style type="text/css"> <!-- body { font-family: "Courier New"; font-size: 11pt;color: #000000 } .u0 { font-family: "Courier New"; font-size: 11pt;color: #000000 } .u1 { font-family: "Courier New"; font-size: 11pt; font-style: italic;color: #008000 } .u2 { font-family: "Courier New"; font-size: 11pt;color: #0000FF } .u3 { font-family: "Courier New"; font-size: 11pt;color: #008080 } .u4 { font-family: "Courier New"; font-size: 11pt;color: #000000 } .u5 { font-family: "Courier New"; font-size: 11pt; font-weight: bold;color: #000080 } .u6 { font-family: "Courier New"; font-size: 11pt;color: #FF0000 } .u7 { font-family: "Courier New"; font-size: 11pt;color: #000000 } .u8 { font-family: "Courier New"; font-size: 11pt;color: #0000FF } .u9 { font-family: "Courier New"; font-size: 11pt;color: #000000 } .u10 { font-family: "Courier New"; font-size: 11pt;color: #0000FF } --> </style> </head> <body bgcolor="#FFFFFF"> <!--StartFragment--><span class="u5">function</span> <span class="u4">PAIsWindowMinimized</span><span class="u9">(</span><span class="u4">h</span><span class="u9">:</span> <span class="u4">HWND</span><span class="u9">):</span> <span class="u4">Boolean</span><span class="u9">;</span> <br><span class="u9"></span><span class="u1">// Detects whether a window is minimized or not</span> <br><span class="u5">var</span> <br> <span class="u4">wp</span><span class="u9">:</span> <span class="u4">Winapi</span><span class="u9">.</span><span class="u4">Windows</span><span class="u9">.</span><span class="u4">WINDOWPLACEMENT</span><span class="u9">;</span> <br><span class="u5">begin</span> <br> <span class="u4">wp</span><span class="u9">.</span><span class="u4">length</span> <span class="u9">:=</span> <span class="u4">SizeOf</span><span class="u9">(</span><span class="u4">Winapi</span><span class="u9">.</span><span class="u4">Windows</span><span class="u9">.</span><span class="u4">WINDOWPLACEMENT</span><span class="u9">);</span> <br> <span class="u4">Winapi</span><span class="u9">.</span><span class="u4">Windows</span><span class="u9">.</span><span class="u4">GetWindowPlacement</span><span class="u9">(</span><span class="u4">h</span><span class="u9">,</span> <span class="u9">@</span><span class="u4">wp</span><span class="u9">);</span> <br> <span class="u4">Result</span> <span class="u9">:=</span> <span class="u4">wp</span><span class="u9">.</span><span class="u4">showCmd</span> <span class="u9">=</span> <span class="u4">Winapi</span><span class="u9">.</span><span class="u4">Windows</span><span class="u9">.</span><span class="u4">SW_SHOWMINIMIZED</span><span class="u9">;</span> <br><span class="u5">end</span><span class="u9">;</span> <!--EndFragment--></body> </html> * BTW, the fragment exported by CNWizards does not create the squares in the faulty WinWord document. Edited June 30, 2019 by PeterPanettone Share this post Link to post
PeterPanettone 158 Posted June 30, 2019 (edited) I have filed a bug report here: https://sourceforge.net/p/gexperts/bugs/128/ The bug report has also the WinWord document file attached with which the bug can be reproduced. Edited June 30, 2019 by PeterPanettone 1 1 Share this post Link to post
dummzeuch 1506 Posted July 6, 2019 I have just updated SynEdit to the latest version from GitHub. Since both, RTF and HTML-Snippets are generated using the functionality in SynEdit, this may solve the problem. But as I said: I haven't got any Winword license to test this. Could you please compile a new dll with the current sources and check? Share this post Link to post
PeterPanettone 158 Posted July 6, 2019 8 minutes ago, dummzeuch said: Could you please compile a new dll with the current sources and check? Yes, I will test it. Thank you very much! Share this post Link to post
PeterPanettone 158 Posted July 6, 2019 Test results: Nothing seems to have changed. This means that pasting in the faulty WinWord document still shows the squares at line starts. In a normal new WinWord document, there is no problem, the fragment looks as desired with the correct syntax highlighting. Here is the HTML exported by GExperts: Version:0.9 StartHTML:0000000105 EndHTML:0000002128 StartFragment:0000001413 EndFragment:0000002112 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Fragment of MainForm.pas</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="generator" content="SynEdit HTML exporter" /> <style type="text/css"> <!-- body { color: #000000; background-color: #FFFFFF; } .pas1-assembler { background-color: #FFFFFF; color: #000000; } .pas1-character { background-color: #FFFFFF; color: #0000FF; } .pas1-comment { background-color: #FFFFFF; color: #008000; font-style: italic; } .pas1-float { background-color: #FFFFFF; color: #0000FF; } .pas1-hexadecimal { background-color: #FFFFFF; color: #0000FF; } .pas1-identifier { background-color: #FFFFFF; color: #000000; } .pas1-number { background-color: #FFFFFF; color: #0000FF; } .pas1-preprocessor { background-color: #FFFFFF; color: #008000; font-style: italic; } .pas1-reservedword { background-color: #FFFFFF; color: #000080; font-weight: bold; } .pas1-space { background-color: #FFFFFF; color: #000000; } .pas1-string { background-color: #FFFFFF; color: #0000FF; } .pas1-symbol { background-color: #FFFFFF; color: #000000; } --> </style> </head> <body> <!--StartFragment--><pre><code><span class="pas1-reservedword">function</span><span class="pas1-space"> PAIsWindowMinimized(h: HWND): Boolean; </span><span class="pas1-comment">// Detects whether a window is minimized or not </span><span class="pas1-reservedword">var </span><span class="pas1-space"> wp: Winapi.Windows.WINDOWPLACEMENT; </span><span class="pas1-reservedword">begin </span><span class="pas1-space"> wp.length := SizeOf(Winapi.Windows.WINDOWPLACEMENT); Winapi.Windows.GetWindowPlacement(h, @wp); Result := wp.showCmd = Winapi.Windows.SW_SHOWMINIMIZED; </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">; </span></code></pre><!--EndFragment--></body> </html> Share this post Link to post
PeterPanettone 158 Posted July 6, 2019 BTW, I've found absolutely no use for the "HTML fragment text" export option: ... since this option copies a very simplified HTML text to the clipboard which seems to be useless: <pre> <code><span style="font: 10pt Courier New;"><span class="pas1-reservedword">function</span><span class="pas1-space"> PAIsWindowMinimized(h: HWND): Boolean; </span><span class="pas1-comment">// Detects whether a window is minimized or not </span><span class="pas1-reservedword">var </span><span class="pas1-space"> wp: Winapi.Windows.WINDOWPLACEMENT; </span><span class="pas1-reservedword">begin </span><span class="pas1-space"> wp.length := SizeOf(Winapi.Windows.WINDOWPLACEMENT); Winapi.Windows.GetWindowPlacement(h, @wp); Result := wp.showCmd = Winapi.Windows.SW_SHOWMINIMIZED; </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">; </span></span> </code></pre> Share this post Link to post
dummzeuch 1506 Posted July 6, 2019 This seems to be missing the CSS for the various span elements. It's possible that this was meant to copy multiple code fragments into the same document which already has got the CSS definitions. But I don't really know, I have never used or looked at this functionality before. Share this post Link to post
PeterPanettone 158 Posted July 6, 2019 BTW, I've found the Fragment prefix useless: Version:0.9 StartHTML:0000000105 EndHTML:0000002128 StartFragment:0000001413 EndFragment:0000002112 This becomes clear when you try to paste the HTML from the clipboard clip exported by GExperts into a Thunderbird e-mail with Insert/HTML: In this case, you should omit the first five lines shown above. Despite many experiments I made, I have not found an easy and satisfactory way to export source code with correct syntax highlighting to a Thunderbird e-mail. So I will either try to correct the GExperts expert or to create my own solution, where I tend to the latter. Share this post Link to post
dummzeuch 1506 Posted July 6, 2019 (edited) 7 minutes ago, PeterPanettone said: BTW, I've found the Fragment prefix useless: Version:0.9 StartHTML:0000000105 EndHTML:0000002128 StartFragment:0000001413 EndFragment:0000002112 This is something defined by Microsoft: https://docs.microsoft.com/en-us/windows/win32/dataxchg/html-clipboard-format When I paste such a fragment into Notepad++ (or the standard Notepad) I don't get these prefixes. So I guess it's Thunderbird which does not know how to handle it. Edited July 6, 2019 by dummzeuch Share this post Link to post
PeterPanettone 158 Posted July 6, 2019 1 minute ago, dummzeuch said: So I guess it's Thunderbird which does not know how to handle it. Probable. Share this post Link to post
PeterPanettone 158 Posted July 6, 2019 BTW, in the file \gexperts-code-r2671-trunk\Projects\DelphiXx103\GExpertsRS103_version.ini there is this typo: InternalName=GExperts for Delphi 10.3 Tokyo Shouldn't it be "Rio"? Share this post Link to post
dummzeuch 1506 Posted July 6, 2019 1 minute ago, PeterPanettone said: BTW, in the file \gexperts-code-r2671-trunk\Projects\DelphiXx103\GExpertsRS103_version.ini there is this typo: InternalName=GExperts for Delphi 10.3 Tokyo Shouldn't it be "Rio"? Ouch, I fixed the version number but not the name. Share this post Link to post
dummzeuch 1506 Posted July 6, 2019 (edited) Copying as "Formatted text/RTF/HTML" does not create an html fragment but a document complete with CSS. Have you tried that? Of course it depends which of the three formats the receiving application inserts. OK, it won't work either. Thunderbird in that case simply inserts plain text. 😞 Edited July 6, 2019 by dummzeuch Share this post Link to post
dummzeuch 1506 Posted July 6, 2019 My version of Thunderbird (52.9.1) doesn't insert the prefix for a HTML fragment, but it shows the code as HTML code (the same goes for RTF fragment) No formatted text at all. I'll update and check the latest version too Share this post Link to post
PeterPanettone 158 Posted July 6, 2019 25 minutes ago, dummzeuch said: but it shows the code as HTML code You must use Einfügen - > HTML: Share this post Link to post
PeterPanettone 158 Posted July 6, 2019 It's also interesting: If I save the fragment from GExperts to a RTF file and then open it in WinWord, then it looks correct. But when I copy that from WinWord and paste it into a Thunderbird e-mail I get lines as paragraphs: This means that the saved RTF file lacks paragraph information (or Thunderbird is not able to transform paragraphs to lines). Share this post Link to post