问题描述
我的应用程序将表格数据写入Windows复制缓冲区,以供用户粘贴到Excel中.对于未格式化的表格数据(包括制表位和用于单元格和行分度符的新行),此方法效果很好.
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?
推荐答案
是的,这是可能的(显然,您可以通过剪贴板将格式化的Excel数据从一个运行中的Excel实例复制到另一个实例中,因此这是必须的!)
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!)
请记住,Windows剪贴板可以同时容纳多种格式的内容.您想要Excel格式的网格内容的格式称为BIFF,即二进制交换文件格式.它与Excel实际存储文件的格式相同. BIFF文档的合理来源可从Open获得.办公室.
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.
弄清楚BIFF的基础知识之后,您会发现生成所需BIFF的最简单方法是从Excel电子表格中复制所需单元格的模型并检查剪贴板中的内容.
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.
这篇关于在Windows剪贴板复制缓冲区中包括格式信息以粘贴到Excel中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!