如何使用剪贴板从.NET应用程序的数据转移到Excel? [英] How use clipboard to move data from .NET application to Excel?

查看:297
本文介绍了如何使用剪贴板从.NET应用程序的数据转移到Excel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是Excel的$ P从剪贴板中接收数据$ pferred格式?这些数据是在C#/。NET应用程序。

Which is Excel's preferred format for receiving data from the clipboard? The data is in a C# / .NET application.

我一直保存到CSV格式的剪贴板,但现在我要开始给的Excel格式的信息(例如,做一些大胆的细胞)。 CSV格式是远远不够的。

I had been saving to the clipboard in CSV format, but now I want to start giving Excel formatting information (eg. make some cells bold). CSV format is no longer enough.

当我从Excel中复制,剪贴板拥有24格式!

When I copy from Excel, the clipboard holds 24 formats!

System.Windows.Clipboard.GetDataObject().GetFormats().Dump();

  • EnhancedMetafile
  • System.Drawing.Imaging.Metafile
  • METAFILEPICT
  • 位图
  • System.Drawing.Bitmap
  • System.Windows.Media.Imaging.BitmapSource
  • BIFF12
  • BIFF8
  • BIFF5
  • SymbolicLink
  • DataInterchangeFormat
  • XML US preadsheet
  • HTML格式
  • 文本
  • 在统一codeTEXT
  • System.String
  • CSV
  • 在富文本格式
  • 嵌入源
  • 在对象描述符
  • 链接源
  • 在链接源的描述符
  • 链接
  • Format129
  • *

    • EnhancedMetafile
    • System.Drawing.Imaging.Metafile
    • MetaFilePict
    • Bitmap
    • System.Drawing.Bitmap
    • System.Windows.Media.Imaging.BitmapSource
    • Biff12
    • Biff8
    • Biff5
    • SymbolicLink
    • DataInterchangeFormat
    • XML Spreadsheet
    • HTML Format
    • Text
    • UnicodeText
    • System.String
    • CSV
    • Rich Text Format
    • Embed Source
    • Object Descriptor
    • Link Source
    • Link Source Descriptor
    • Link
    • Format129
    • *

      推荐答案

      我相信你所看到的是,Excel的prepares当你复制到许多不同的格式剪贴板取决于你在哪里结束粘贴数据它。你可能需要寻找到Office XML格式的Excel。

      I believe what you're seeing is that Excel prepares the data when you copy to the clipboard in many different formats depending on where you end up pasting it. You probably need to look into the Office XML format for Excel.

      有一个更好的主意的,请参阅此例如XML 在Wikipedia格式。虽然我以前从未使用过它,我是pretty的肯定Excel中只会让你直接在XML粘贴(如果这是正确的模式)。

      See this example xml at Wikipedia for a better idea of the format. While I've never used it before, I'm pretty sure Excel would simply let you paste in the XML directly (if it's the right schema).

      这篇关于如何使用剪贴板从.NET应用程序的数据转移到Excel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆