Categories | Question details Back To List | ||
determine number of rows on paste from clipboard Hello, I use the following piece of code to paste info from the clipboard (Excel) into the GRID. function onKeyPressed(code,ctrl,shift){ if(code==67&&ctrl){ mygrid.setCSVDelimiter("\t") mygrid.copyBlockToClipboard() } if(code==86&&ctrl){ mygrid.setCSVDelimiter("\t") mygrid.pasteBlockFromClipboard() } return true; } The number of columns is always fixed, but the number of rows should be determined based on the number of rows on the clipboard. How should I do this? As alternative I tried to do the following (based on the Help): mygrid.clearAll(); mygrid.setCSVDelimiter("\t"); mygrid.gridFromClipboard(); mygrid.updateRowFromClipboard(); mygrid.addRowFromClipboard(); mygrid.updateCellFromClipboard(); When doing this I always loose the first colmn somehow, and only subsequent column are pasted. Thanks for your help. Best regards, Archer Answer posted by Support on Apr 16, 2008 09:14 >>but the number of rows should be determined based on the number of rows pasteBlockFromClipboard only updates existing data in grid, it can't be used to add new rows >>When doing this I always loose the first colmn somehow, and only subsequent column are pasted. to resolve issue you need to add next command before adding rows from clipboard. grid.enableCSVAutoID(true); |