This isn't exactly what you asked about but it's close.

I use the method below to copy selected rows to clipboard.  In this use I
have a tab character to separate the columns, elsewhere I provide the user
the choice between tab and comma with a separate dialog.

            private function syncCopyToClipboard():void
            {
                // Separator used between Strings sent to clipboard
                // to separate selected cells.
                var separator:String = "\t";
                if (syncComma.selected) separator = ",";

                // The String sent to the clipboard
                System.setClipboard(" ");
                var dataString:String = "";
                var n:int = dgSyncGroupMembers.selectedCells.length;
                if (n == 0)
                {
                    Alert.show("You have not selected any rows, to select
all rows: click on the first row, scroll to the bottom and shift click on
the last row. Otherwise, select specific rows before you press the copy to
clipboard button.");
                }
                for (var i:int = 0; i < n; i++)
                {
                    var cell:Object = dgSyncGroupMembers.selectedCells[i];
                    var data:Object =
dgSyncGroupMembers.dataProvider[cell.rowIndex];
                    var nameField:String =
dgSyncGroupMembers.columns[0].dataField;
                    var valuField:String =
dgSyncGroupMembers.columns[1].dataField;
                    dataString = data[nameField] + separator +
data[valuField] + "\n" + dataString;
                }

                // Write dataString to the clipboard.
                System.setClipboard(dataString);
            }

Reply via email to