this is the function that adds the clipboard contents to the table
506419
public void pasteClipboard() {
        Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
        try {
            if (t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
                addContents((String) t.getTransferData(DataFlavor.stringFlavor));
                table.repaint();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
84407
def paste_format(self):
        

        row, col, tab = self.grid.actions.cursor

        selection = self.get_selection()
        if selection:
            # Use selection rather than cursor for top left cell if present
            row, col = [tl if tl is not None else 0
                        for tl in selection.get_bbox()[0]]

        cell_attributes = self.grid.code_array.cell_attributes

        string_data = self.grid.main_window.clipboard.get_clipboard()
        format_data = ast.literal_eval(string_data)

        ca = format_data["cell_attributes"]
        rh = format_data["row_heights"]
        cw = format_data["col_widths"]

        assert isinstance(ca, types.ListType)
        assert isinstance(rh, types.DictType)
        assert isinstance(cw, types.DictType)

        # Cell attributes

        for selection_params, tab, attrs in ca:
            base_selection = Selection(*selection_params)
            shifted_selection = base_selection.shifted(row, col)
            if "merge_area" not in attrs:
                # Do not paste merge areas because this may have
                # inintended consequences for existing merge areas
                new_cell_attribute = shifted_selection, tab, attrs
                cell_attributes.append(new_cell_attribute)

        # Row heights
        row_heights = self.grid.code_array.row_heights
        for __row, __tab in rh:
            row_heights[__row+row, tab] = rh[__row, __tab]

        # Column widths
        col_widths = self.grid.code_array.col_widths
        for __col, __tab in cw:
            col_widths[__col+col, tab] = cw[(__col, __tab)]
132189
def add_table_item(self, table):
        
        if not table.is_draft_version:
            raise ValueError("Table isn't a draft version")

        self.items.append(table.latest_version)
505764
def paste(self,e):
        '''
        if self.enable_win32_clipboard:
                txt=clipboard.get_clipboard_text_and_convert(False)
                self.insert_text(txt)
588958
function tableCellGenerator(amount, tagName) {
  const brHTMLString = '<br />';
  const cellString = `<${tagName}>${brHTMLString}</${tagName}>`;
  let tdString = '';

  for (let i = 0; i < amount; i += 1) {
    tdString = tdString + cellString;
  }

  return tdString;
}
2061
function insertArray (table, object, fields) {
  var input = this

  input.forEach(function addRow (entry, rowNo) {
    var tableRow = fields.map(function cell (fieldName) {
      return getCellContent.call(entry, object.fields[fieldName], rowNo)
    })
    table.push(tableRow)
  })
}
795797
def paste( self ):
        
        text = nativestring(QApplication.clipboard().text())
        for tag in text.split(','):
            tag = tag.strip()
            if ( self.isTagValid(tag) ):
                self.addTag(tag)
964651
def add(self, func, **kwargs):
        

        params = set(kwargs.keys())
        func_params = set(inspect.getargspec(func).args)

        # ignore self, which is present when extending Notebook.
        if 'self' in func_params:
            func_params.remove('self')

        if params != func_params:
            fatal('Params {} not matching cells function params {}'.format(list(params), list(func_params)))

        lines = inspect.getsourcelines(func)[0][1:]

        buffer = ""
        indent_count = None
        inside_markdown = False
        return_found = False

        for line in lines:

            # remove base indentation of function 'func'
            if len(line.strip()) > 0:
                if not indent_count:
                    indent_count = 0
                    for c in line:
                        if c not in [' ', '\t']:
                            break
                        else:
                            indent_count += 1
                line = line[indent_count:]

            if not inside_markdown and line.strip() == "return":
                logging.info('Encountered "return" statement, ignoring the rest of the notebook.')
                break

            if line.strip() == "'''":  # if md block begin/end, or new cell...
                if len(buffer.strip()) > 0:
                    if not inside_markdown:  # if md block begin: new markdown block! flush buffer
                        self.add_cell_code(buffer)
                    else:  # if md block end: markdown block completed! flush buffer
                        self.add_cell_markdown(buffer)
                buffer = ""
                inside_markdown = not inside_markdown
            else:
                buffer += line

        if len(buffer.strip()) > 0:
            if not inside_markdown:
                self.add_cell_code(buffer)
            else:
                self.add_cell_markdown(buffer)

        if len(kwargs) > 0:
            # We have parameters to inject into the notebook.
            # If the first cell is Markdown, assume that is the title and
            # insert parameters as 2nd cell. Otherwise, as 1st cell.
            if len(self.nb['cells']) > 0 and self.nb['cells'][0].cell_type == 'markdown':
                self.add_cell_params(kwargs, 1)
            else:
                self.add_cell_params(kwargs, 0)
540565
function addColToCellAfter($cell, numberOfCols = 1) {
  const index = $cell.index();
  let cellToAdd;

  $cell.parents('table').find('tr').each((n, tr) => {
    const isTBody = domUtils.getNodeName(tr.parentNode) === 'TBODY';
    const isMSIE = util.browser.msie;
    const cell = tr.children[index];
    for (let i = 0; i < numberOfCols; i += 1) {
      if (isTBody) {
        cellToAdd = document.createElement('td');
      } else {
        cellToAdd = document.createElement('th');
      }
      if (!isMSIE) {
        cellToAdd.appendChild(document.createElement('br'));
      }
      $(cellToAdd).insertAfter(cell);
    }
  });
}
144501
function getClipboardDataByPastebin( evt, callback ) {
			var doc = editor.document,
				editable = editor.editable(),
				cancel = function( evt ) {
					evt.cancel();
				},
				blurListener;

			// Avoid recursions on 'paste' event or consequent paste too fast. (#5730)
			if ( doc.getById( 'cke_pastebin' ) )
				return;

			var sel = editor.getSelection();
			var bms = sel.createBookmarks();

			// #11384. On IE9+ we use native selectionchange (i.e. editor#selectionCheck) to cache the most
			// recent selection which we then lock on editable blur. See selection.js for more info.
			// selectionchange fired before getClipboardDataByPastebin() cached selection
			// before creating bookmark (cached selection will be invalid, because bookmarks modified the DOM),
			// so we need to fire selectionchange one more time, to store current seleciton.
			// Selection will be locked when we focus pastebin.
			if ( CKEDITOR.env.ie )
				sel.root.fire( 'selectionchange' );

			// Create container to paste into.
			// For rich content we prefer to use "body" since it holds
			// the least possibility to be splitted by pasted content, while this may
			// breaks the text selection on a frame-less editable, "div" would be
			// the best one in that case.
			// In another case on old IEs moving the selection into a "body" paste bin causes error panic.
			// Body can't be also used for Opera which fills it with <br>
			// what is indistinguishable from pasted <br> (copying <br> in Opera isn't possible,
			// but it can be copied from other browser).
			var pastebin = new CKEDITOR.dom.element(
				( CKEDITOR.env.webkit || editable.is( 'body' ) ) && !CKEDITOR.env.ie ? 'body' : 'div', doc );

			pastebin.setAttributes( {
				id: 'cke_pastebin',
				'data-cke-temp': '1'
			} );

			var containerOffset = 0,
				offsetParent,
				win = doc.getWindow();

			if ( CKEDITOR.env.webkit ) {
				// It's better to paste close to the real paste destination, so inherited styles
				// (which Webkits will try to compensate by styling span) differs less from the destination's one.
				editable.append( pastebin );
				// Style pastebin like .cke_editable, to minimize differences between origin and destination. (#9754)
				pastebin.addClass( 'cke_editable' );

				// Compensate position of offsetParent.
				if ( !editable.is( 'body' ) ) {
					// We're not able to get offsetParent from pastebin (body element), so check whether
					// its parent (editable) is positioned.
					if ( editable.getComputedStyle( 'position' ) != 'static' )
						offsetParent = editable;
					// And if not - safely get offsetParent from editable.
					else
						offsetParent = CKEDITOR.dom.element.get( editable.$.offsetParent );

					containerOffset = offsetParent.getDocumentPosition().y;
				}
			} else {
				// Opera and IE doesn't allow to append to html element.
				editable.getAscendant( CKEDITOR.env.ie ? 'body' : 'html', 1 ).append( pastebin );
			}

			pastebin.setStyles( {
				position: 'absolute',
				// Position the bin at the top (+10 for safety) of viewport to avoid any subsequent document scroll.
				top: ( win.getScrollPosition().y - containerOffset + 10 ) + 'px',
				width: '1px',
				// Caret has to fit in that height, otherwise browsers like Chrome & Opera will scroll window to show it.
				// Set height equal to viewport's height - 20px (safety gaps), minimum 1px.
				height: Math.max( 1, win.getViewPaneSize().height - 20 ) + 'px',
				overflow: 'hidden',
				// Reset styles that can mess up pastebin position.
				margin: 0,
				padding: 0
			} );

			// Check if the paste bin now establishes new editing host.
			var isEditingHost = pastebin.getParent().isReadOnly();

			if ( isEditingHost ) {
				// Hide the paste bin.
				pastebin.setOpacity( 0 );
				// And make it editable.
				pastebin.setAttribute( 'contenteditable', true );
			}
			// Transparency is not enough since positioned non-editing host always shows
			// resize handler, pull it off the screen instead.
			else
				pastebin.setStyle( editor.config.contentsLangDirection == 'ltr' ? 'left' : 'right', '-1000px' );

			editor.on( 'selectionChange', cancel, null, null, 0 );

			// Webkit fill fire blur on editable when moving selection to
			// pastebin (if body is used). Cancel it because it causes incorrect
			// selection lock in case of inline editor (#10644).
			// The same seems to apply to Firefox (#10787).
			if ( CKEDITOR.env.webkit || CKEDITOR.env.gecko )
				blurListener = editable.once( 'blur', cancel, null, null, -100 );

			// Temporarily move selection to the pastebin.
			isEditingHost && pastebin.focus();
			var range = new CKEDITOR.dom.range( pastebin );
			range.selectNodeContents( pastebin );
			var selPastebin = range.select();

			// If non-native paste is executed, IE will open security alert and blur editable.
			// Editable will then lock selection inside itself and after accepting security alert
			// this selection will be restored. We overwrite stored selection, so it's restored
			// in pastebin. (#9552)
			if ( CKEDITOR.env.ie ) {
				blurListener = editable.once( 'blur', function( evt ) {
					editor.lockSelection( selPastebin );
				} );
			}

			var scrollTop = CKEDITOR.document.getWindow().getScrollPosition().y;

			// Wait a while and grab the pasted contents.
			setTimeout( function() {
				// Restore main window's scroll position which could have been changed
				// by browser in cases described in #9771.
				if ( CKEDITOR.env.webkit )
					CKEDITOR.document.getBody().$.scrollTop = scrollTop;

				// Blur will be fired only on non-native paste. In other case manually remove listener.
				blurListener && blurListener.removeListener();

				// Restore properly the document focus. (#8849)
				if ( CKEDITOR.env.ie )
					editable.focus();

				// IE7: selection must go before removing pastebin. (#8691)
				sel.selectBookmarks( bms );
				pastebin.remove();

				// Grab the HTML contents.
				// We need to look for a apple style wrapper on webkit it also adds
				// a div wrapper if you copy/paste the body of the editor.
				// Remove hidden div and restore selection.
				var bogusSpan;
				if ( CKEDITOR.env.webkit && ( bogusSpan = pastebin.getFirst() ) && ( bogusSpan.is && bogusSpan.hasClass( 'Apple-style-span' ) ) )
					pastebin = bogusSpan;

				editor.removeListener( 'selectionChange', cancel );
				callback( pastebin.getHtml() );
			}, 0 );
		}
1357536
def add_row(self, text, link=None, bold=False, align=None):
        """"""
        if not self.table_columns_left:
            # Starting a new row
            self.write('<tr>')
            self.table_columns_left = self.table_columns

        self.write('<td')
        if align:
            self.write(' style="text-align:{}"', align)
        self.write('>')

        if bold:
            self.write('<b>')
        if link:
            self.write('<a href="{}">', self._rel(link))

        # Finally write the real table data, the given text
        self.write(text)

        if link:
            self.write('</a>')
        if bold:
            self.write('</b>')

        self.write('</td>')

        self.table_columns_left -= 1
        if not self.table_columns_left:
            self.write('</tr>')
918967
def paste(self):
        
        html = QApplication.clipboard().text()
        if not self.isRichTextEditEnabled():
            self.insertPlainText(projex.text.toAscii(html))
        else:
            super(XTextEdit, self).paste()
1159148
function syncTableData () {

    var tableData = getTableData();

    for ( var i = 1, row; row = editorTable.rows[ i ]; i++ ) {

        for ( var j = 1, cell; cell = row.cells[ j ]; j++ ) {

            cell.innerHTML = tableData[ i ] [ j ];

        }

    }

}
653298
function stuffCellsIntoIncompleteRow(tableData, limitIndex) {
  tableData.forEach((rowData, rowIndex) => {
    const startIndex = rowData.length;
    if (startIndex) {
      const [{nodeName}] = rowData;

      util.range(startIndex, limitIndex).forEach(colIndex => {
        rowData.push(createBasicCell(rowIndex, colIndex, nodeName));
      });
    }
  });
}
1106619
def create_clipboard(self, text, selection=Gdk.SELECTION_CLIPBOARD):
        
        clipboard = Gtk.Clipboard.get(selection)
        clipboard.set_text('\n'.join(text), -1)
        clipboard.store()
        return clipboard
1333604
function() {

			var self = this;

			// Populate table html
			var content = ['<table class="' + this.tableClass + '" data-instance="' + this.instanceCount + '"><thead>',
				'<tr>'];

			for (var i in this.source.columns) {

				var sortContent = this.source.columns[i].name,
					colDir = self.source.columns[i].dir;

				if (self.source.colSortIdx == i) {
					sortContent = self.formatSortHeader(this.source.columns[i].name, colDir)
				}
				
				content.push('<th class="col-' + i + '"><a data-col-idx="' + i + '" data-sort="sort" href="#" title="' + this.source.columns[i].name +'">' + sortContent + '</a></th>');
			}

			content.push('</tr></thead><tbody>');

			for (var i = 0, rows = this.source.data.length; i < rows; i++) {
				var datum = this.source.data[i];

				// Add in a reference to the data
				dataLookup[this.instanceCount][i] = datum

				content.push('<tr class="row-' + i + '"">');

				for (var j in this.source.columns) {
					content.push('<td class="col-' + j +'">' + this.source.columns[j].formatter(datum) + '</td>');
				}

				content.push('</tr>');
			}

			content.push('</tbody></table>');

			this.node.setHtml(content.join(''));

			this.node.one('table thead').on('click', function(e) {
				if (e.target.data('sort')) {
					self.sort(e.target);

					self.node.all('th a').item(e.target.data('col-idx'))._node.focus()
					e.stop();
				}
			});
			this.node.fire('render')
		}
1101149
def _textToTable(self, text, separator='\t'):
        
        table = None
        if text.startswith('[[') or text.startswith('(('):
            try:
                # maybe it's already formated as a list e.g. "[['1','2'],[...]]"
                # check it:
                t = eval(text)
            # has to be a 2d-list:
                if isinstance(t, list) and isinstance(t[0], list):
                    table = t
            except SyntaxError:
                # not a valid list
                pass
        if not table:
            # create the list from the clipboard-text
            # therefore the text has to be formated like this:
                # "1\t2\3\n4\t5\6\n"
            table = text.split('\n')
            n = 0
            while n < len(table):
                sline = table[n].split(separator)
                if sline != ['']:
                    table[n] = sline
                else:
                    table.pop(n)
                    n -= 1
                n += 1
        return table