My application writes tabular data to the windows copy buffer for the user to paste into Excel. This works fine for unformatted tabular data including tab-stops and new lines for cell and row delimeters.
I'd like to include formatting data in the copy buffer: grid lines, background colors, etc. Can I do this, and if so, where can I find a specification for encoding the formatting data?
Yes, it's possible (obviously, you can copy formatted Excel data from one running instance of Excel to another via the clipboard, so it must be possible!)
Remember that the Windows clipboard can hold things in more than one format at the same time. The format you want for Excel formatted grid stuff is called BIFF, that is, The Binary Interchange File Format. It's the same format as Excel actually stores files in. A reasonable source of BIFF documentation is available from Open Office.
Once you figure out the basics of BIFF, you'll find that the easiest way to generate the BIFF you want is to copy a model of the cells you want from an Excel spreadsheet and examine what's in the clipboard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With