U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » ArrayCtrl copy to the Clipboard
Re: ArrayCtrl copy to the Clipboard [message #22723 is a reply to message #22703] Sat, 08 August 2009 21:11 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
koldo wrote on Thu, 06 August 2009 10:17

Hello Mirek

A sample that works for me is in GridCtrl.cpp, function GridCtrl::SetClipboard, where the separation between rows is with \r\n and between columns is with \t.

This way the cells are pasted well in MS Excel and in Open Office.

A thing to care with is not to add aditional tabs per row as in GridCtrl. This additional tab deletes the next column in Excel.

So to copy this:

First   Row
Second  Row

it has to be passed to the clipboard this:

"First\tRow\r\nSecond\tRow"

instead of this:

"First\tRow\t\r\nSecond\tRow\t"

Thank you very much
Koldo


String s;
for(int i = 0; i < array.GetCount(); i++) {
    for(int j = 0; j < columns; j++) {
         if(j) s << '\t';
         s << AsString(array.Get(i,j);
    }
    s << "\r\n";
}
WriteClipboardText(s);


Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GridCtrl and copy to clipboard
Next Topic: Export Ctrl to qtf table
Goto Forum:
  


Current Time: Sun Jul 19 11:06:42 GMT+2 2026

Total time taken to generate the page: 0.00715 seconds