public static String getCellString4Clipboard(Grid aGrid)
{
StringBuffer result = new StringBuffer();
int prevRow, curRow; // For new-line inserting
int i, size;
Point[] selCells = aGrid.getCellSelection();
size = selCells.length;
// For the first selected cell
i = 0;
result.append(aGrid.getItem(selCells[i].y).getText(selCells[i].x));
prevRow = selCells[i].y;
// Remains
for(i = 1; i < size; i++)
{
curRow = selCells[i].y;
if (prevRow != curRow)
result.append(System.getProperty("line.separator"));
else
result.append("\t");
result.append(aGrid.getItem(selCells[i].y).getText(selCells[i].x));
prevRow = curRow;
}
return result.toString();
}