I wrote a custom WPF app in C# to help me track my daily activities. At the end of the week I have to fill in this data into MS Dynamics NAV 5.0, which our company uses. Since I don't want to type all the data again, I thought copying all to the clipboard and pasting it into the table in NAV would be cool.
So I copied some rows of that table from NAV first and analyzed the DataObject in the Clipboard. There were 5 values:
DataFormat "Text": The complete text as string. Column header text separated by tabulator (0x09) then the rows with values also separated by tabulator. Each row is separated by CR/LF (0x0D,0x0A).
DataFormat "UnicodeText": Exactly the same as in "Text". Byte for byte.
DataFormat "System.String": This value is null.
DataFormat "Locale": A MemoryStream with 4 bytes: 0x07, 0x04, 0x00, 0x00
DataFormat "OEMText": Just as "UnicodeText" exactly the same as "Text" byte for byte.
I formatted my data exactly as NAV did and put all 5 values into the DataObject. Unfortunately when I try to paste it into NAV it is not working. Either, when a complete row is selected, nothing happens. Or, when the cursor is is a cell, the complete text with all the tabulators and linebreaks is pasted into the current cell.
First I thought I did something wrong. So I copied some rows from the table in NAV. Then I read byte for byte so I can reproduce this information. I cleared the Clipboard and recreated the data byte for byte. From a C# point of view the data was exactly the same. Still I couldn't paste it back into NAV.
Is there some information in the clipboard I can't evaluate in C#? Or what else am I doing wrong?