Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » GridCtrl - copy all [Feature Request]
GridCtrl - copy all [Feature Request] [message #16154] |
Thu, 29 May 2008 20:33  |
nixnixnix
Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
|
Senior Member |
|
|
Hey Daniel,
I use very large grids and I'd like my users to be able to copy and paste the whole thing to excel or openoffice. Would it be a lot of work for you to add a CopyAll() function which would look at the current size of the grid and copy everything in it (text and values) to the clipboard please?
Nick
|
|
|
|
|
Re: GridCtrl - copy all [Feature Request] [message #16165 is a reply to message #16161] |
Fri, 30 May 2008 08:56   |
pepe11
Messages: 16 Registered: June 2006 Location: Slovakia
|
Promising Member |

|
|
Maybe this help to you :
.....
GridCtrl ar;
.....
vmr2.ar.WhenMenuBar=THISBACK1(SubMenuGC,&(vmr2.ar));
.....
void SubMenuGC(Bar& bar,GridCtrl* pod1) { bar.Add(pod1->GetCount(),"Export to clipboard",TImgVaV::copy() , THISBACK1(KopirovanieGC,pod1)).Help("Export to clipboard").Key(K_CTRL_C);
.....
bar.Add(IsClipboardAvailableText(),"Paste from clipboard",TImgVaV::paste() , THISBACK2(PasteGC,pod1,false)).Help("Paste from clipboard").Key(K_CTRL_V);
.....
}
void CopyAllGC(GridCtrl* pod1)
{
WString txt;
int i,first=0;
if(pod1->GetCount()>0)
{
i=pod1->GetColumnCount();
if(!pod1->IsSelection() && pod1->GetSelectedItemsCount()>0)
{
for(int y=0;y<i;y++)
{
txt.Cat((first?"\t":""));
first=1;
txt.Cat(pod1->GetColumn(y).GetName().ToWString());
}
txt.Cat("\r\n");
}
for(int z=0;z<pod1->GetCount();z++)
{
first=0;
for(int y=0;y<i;y++) // if(pod1->IsSelected(z,y))
{
txt.Cat((first?"\t":""));
first=1;
txt.Cat(pod1->Get(z,y).ToString().ToWString());
}
if(first) txt.Cat("\r\n");
}
WriteClipboardUnicodeText(txt);// WriteClipboardText(txt.ToString());
}
}
Pepe
|
|
|
|
Re: GridCtrl - copy all [Feature Request] [message #16346 is a reply to message #16154] |
Mon, 09 June 2008 18:32   |
|
nixnixnix wrote on Thu, 29 May 2008 14:33 | Hey Daniel,
I use very large grids and I'd like my users to be able to copy and paste the whole thing to excel or openoffice. Would it be a lot of work for you to add a CopyAll() function which would look at the current size of the grid and copy everything in it (text and values) to the clipboard please?
Nick
|
Done. I added Copy(bool all) and CopyAll(). If all is not true only selected cells are copied to the clipboard.
|
|
|
|
Goto Forum:
Current Time: Tue Apr 29 13:48:13 CEST 2025
Total time taken to generate the page: 0.00720 seconds
|