Copy SYLK formatted text to clipboard from HTA

652 views Asked by At

I'd like to programmatically copy tabular data (both formatting and formulas) to the clipboard from an HTA (HTML Application), to paste into Excel. Excel supports a text format called SYLK for accomplishing this task, but I've run into a snag with over-validation in window.clipboardData.setData(format, data) where format is restricted to either "Text" or "URL", giving the error "Unexpected call to method or property access" if format is set to anything else, and Excel only recognizes SYLK text if format is set to "SYLK", otherwise it pastes as normal text.

I'm wondering if there's another way to set clipboard data from an HTA, such as through a COM control that comes preinstalled with either Windows or Office, that would let me copy SYLK data to the clipboard.

I know I could write a custom COM control and install it on each client, but at that point I might be better off just writing to a file and opening the file instead of using the clipboard.

0

There are 0 answers