In C# I need to copy data-grid rows to excel. Because some values in a row are doubles, \"-Infinity
\" values are possible.
I\'ve tried to copy the rows
The win32 api solution did not work for me. I had had random crashes. Following code works fine, also with unicode chars.
var xml = File.ReadAllText(@"..\..\SampleData\Clipboard-Example3.xml");
var stream = new MemoryStream(Encoding.UTF8.GetBytes(xml));
var dataObject = new DataObject();
dataObject.SetData("XML SpreadSheet", stream);
Clipboard.Clear();
Clipboard.SetDataObject(dataObject);