[Feature Request] HTML Support for TClipboard
Original Reporter info from Mantis: wp @wpam
-
Reporter name:
Original Reporter info from Mantis: wp @wpam
- Reporter name:
Description:
There are cases where it would be a nice add-on if html-formatted text could be interchanged with the clipboard. RTF-formatted texts, for example, would benefit from pasting into word processing applications. Or string grids where the html format would allow copying as a complete table (currently there is only a csv-like clipboard format which requires some post-processing in the receiving application to restore features such as work-wrapping).
The provided patch adds a new clipboard format, CF_HTML, to the clipbrd unit. The class TClipboard gets a new property "AsHtml" along with the corresponding setter/getter method to copy html formatted text to, and paste it back from the clipboard. The transferred string is always a full html string. In case of windows, a specific header is added by the setter without which the text would not be accepted as valid clipboard html.
It remains the responsibility of the calling class to create and analyze the html string according to its requirements. Once this patch is included in the lcl I am planning to implement html clipboard access for TStringGrid.
Additional information:
A test program is attached.
The procedures were tested under Windows (Word, Writer, Excel, Calc) and Linux (Writer, Calc, Gnumeric).
The code is partly based on a unit provided by Bart Broersma.