LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I export formatted text from a string indicator?

This works (see Send HTML code to clipboard by Visual C++ - Visual C++ | Microsoft Docs😞

Clipboard HTML Paste.png

 

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):

Clipboard HTML Paste result.png

0 Kudos
Message 11 of 13
(775 Views)

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.

 

 

beuvink_1-1639754004184.png

 

(string control to HTML will follow when I have to make this.. few weeks or so..)

 

---

25+ years long fan of LabVIEW. Move to Emerson looks to be for the better! See the last posts in subscription model thread.
0 Kudos
Message 12 of 13
(762 Views)

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:

Clipboard HTML Paste (Fix).png

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.

0 Kudos
Message 13 of 13
(756 Views)