How to use clipboard to move data from a .NET application to Excel?

What is the preferred Excel format for receiving data from the clipboard? The data is in the C # /. NET application.

I saved it to the clipboard in CSV format, but now I want to start providing information about Excel formatting (for example, make some cells in bold). The CSV format is no longer enough.


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

System.Windows.Clipboard.GetDataObject().GetFormats().Dump(); 
  • EnhancedMetafile
  • System.Drawing.Imaging.Metafile
  • Metafilepict
  • Bitmap image
  • System.Drawing.Bitmap
  • System.Windows.Media.Imaging.BitmapSource
  • Biff12
  • Biff8
  • Biff5
  • SymbolicLink
  • DataInterchangeFormat
  • XML table
  • HTML format
  • Text
  • UnicodeText
  • System.string
  • Csv
  • Rich Text Format
  • Embed the source code
  • Object handle
  • Link source
  • Link Source Descriptor
  • Link
  • Format129 *
+1
source share
1 answer

I believe that you see that Excel prepares data when copying to the clipboard in many different formats depending on where you paste it. You probably need to learn the Office XML format for Excel.

See this xml example on Wikipedia for a better view of the format. Although I have never used it before, I am sure that Excel will simply allow you to embed XML directly (if that is the correct scheme).

0
source

All Articles