class_docstr: Extends QTableWidget with some useful functions for automatic data handling
  and copy / export context menu. Can automatically format and display a variety
  of data types (see :func:`setData() <pyqtgraph.TableWidget.setData>` for more
  information.
docstr: Convert entire table (or just selected area) into tab-separated text values
docstr_tok: ["Convert","entire","table","(","or","just","selected","area",")","into","tab-separated","text","values"]
code: def serialize(self, useSelection=False):
      """Convert entire table (or just selected area) into tab-separated text values"""
      if useSelection:
          selection = self.selectedRanges()[0]
          rows = list(
              range(selection.topRow(), selection.bottomRow() + 1)
          )
          columns = list(
              range(selection.leftColumn(), selection.rightColumn() + 1)
          )
      else:
          rows = list(range(self.rowCount()))
          columns = list(range(self.columnCount()))
  
      data = []
      if self.horizontalHeadersSet:
          row = []
          if self.verticalHeadersSet:
              row.append("")
  
          for c in columns:
              row.append(self.horizontalHeaderItem(c).text())
          data.append(row)
  
      for r in rows:
          row = []
          if self.verticalHeadersSet:
              row.append(self.verticalHeaderItem(r).text())
          for c in columns:
              item = self.item(r, c)
              if item is not None:
                  row.append(str(item.value))
              else:
                  row.append("")
          data.append(row)
  
      s = ""
      for row in data:
          s += "\t".join(row) + "\n"
      return s
  
imports: import numpy
  from ..Qt import QtCore, QtGui, QtWidgets
label_desc: Use image node_id 16 for calling the TableWidget obj's underlying member method code with example usage: obj.serialize(useSelection) and returns: s