12-17-2021 06:20 AM - edited 12-17-2021 06:22 AM
This works (see Send HTML code to clipboard by Visual C++ - Visual C++ | Microsoft Docs😞
Keep in mind:
+ Preferred Execution System needs to be user interface
+ If there's a previous text in the clipboard, it won't be cleared!
The result (Word):
12-17-2021 09:21 AM
Did run into some issues, was pasting into libreoffice instead of word. Requires the indexes to be set.
Made a VI to copy HTML to clipboard. See attached file.
Still not perfect. This only places HTML data on clipboard. No text is present. Due to this, data can't be copied in -for example notepad++ -.
If a selection is copied from firefox the clipboard contains both HTML and text data. Couldn' replicate this. Calling a new 'set method' clears the the data on the clipboard.
(string control to HTML will follow when I have to make this.. few weeks or so..)
12-17-2021 10:23 AM - edited 12-17-2021 10:50 AM
You probably have to call settext 2X, once with HTML and once with text.
The clipboard is an array of data object, and this method seems to replace one item per call.
To prove this, copy text on the clipboard (manually), then SetText with HTML. Paste in LV, you'll get the text you manually copied.
I'd clear the CB, then paste text and HTML, optionally even an image.
Skip that. LabVIEW has it's own clipboard methods and it doesn't respond to .NET methods. I'd clear LV clipboard, set text to LV clipboard, then use .NET to set HTML:
BTW, you didn't post a snippet, so I had to redo your work on the sizes. Of course I did it my way, but your way is OK. Haven't tested that on OpenOffice.
EDIT: This is a small improvement, but only from within LV... The text still can't be pasted in notepad... I think the SetDataObject might be the solution, if that allows to set an array of objects. I know the traditional API has ways to do it (I found traces of code). It will have to wait till Monday though.