Add enough tabs to align in two columns
350788
def get_margin(length):
    """"""
    if length > 23:
        margin_left = "\t"
        chars = 1
    elif length > 15:
        margin_left = "\t\t"
        chars = 2
    elif length > 7:
        margin_left = "\t\t\t"
        chars = 3
    else:
        margin_left = "\t\t\t\t"
        chars = 4
    return margin_left
208573
def insert_tabs(self, tab, no_tabs=1):
        

        # Mark content as changed
        post_command_event(self.main_window, self.ContentChangedMsg)

        self.code_array.insert(tab, no_tabs, axis=2)

        # Update TableChoiceIntCtrl
        shape = self.grid.code_array.shape
        post_command_event(self.main_window, self.ResizeGridMsg, shape=shape)
579494
def tabLayout(self):
        '''  '''
        self.childWindow.column += 1
        if self.childWindow.column > Layout.BUTTONS_NUMBER:
            self.childWindow.column = 0
            self.childWindow.row += 1
562741
function appendJoinRow(arrayCols, keyDf, leftNonKeyDf, rightNonKeyDf,
  leftInd, rightInd, indicatorValue, rightIndForKey) {

  var keyInd = rightIndForKey ? rightInd : leftInd;
  var i, nCol;
  var colInd = 0;
  nCol = keyDf.nCol();
  for (i = 0; i < nCol; i++) {
    arrayCols[colInd].push(keyDf._cols[i].values[keyInd]);
    colInd++;
  }
  nCol = leftNonKeyDf.nCol();
  for (i = 0; i < nCol; i++) {
    var leftVal = (leftInd === null) ? null :
      leftNonKeyDf._cols[i].values[leftInd];
    arrayCols[colInd].push(leftVal);
    colInd++;
  }
  nCol = rightNonKeyDf.nCol();
  for (i = 0; i < nCol; i++) {
    var rightVal = (rightInd === null) ? null :
      rightNonKeyDf._cols[i].values[rightInd];
    arrayCols[colInd].push(rightVal);
    colInd++;
  }
  if (colInd < arrayCols.length) {
    // Add the join indicator value if there's a final column for it
    arrayCols[colInd].push(indicatorValue);
  }
}
650572
def _format_row(row, colnames, tab):
    
    out=""

    out+="\n<tr>"
    for colname in colnames:
        out+="<td style='vertical-align:top; white-space:pre'>"
        out+=_format_cell(row[colname], tab.getcolkeywords(colname))
        out+="</td>\n"
    out+="</tr>\n"
    return out
1310927
def align_column n, alignment
      r = rows
      column(n).each_with_index do |col, i|
        cell = r[i][n]
        next unless cell
        cell.alignment = alignment unless cell.alignment?
      end
    end
509717
function getTotalTabsWidth(elements) {
    var sum = 0, i, tab;

    for (i = 0; i < elements.tabs.length; i++) {
      tab = elements.tabs[i];
      sum += tab.offsetWidth;
    }

    return sum;
  }
695049
public static void appendTable(ParagraphAlignment[] alignment, int rows, int cols, String[][] values, int[]
            rowHeight, int[] colWidth, Map<String, Integer> cellMargins, Map<String, Object> styles) {
        createXwpfDocumentIfNull();
        xwpfDocument.createParagraph();
        XWPFTable table = xwpfDocument.createTable(rows, cols);
        XWPFParagraph paragraph;
        XWPFTableRow row;
        XWPFTableCell cell;
        CTTcPr cellPr;
        XWPFRun run;
        if (Checker.isNotEmpty(cellMargins)) {
            int top = MsUtils.checkInteger(cellMargins.get("top"));
            int left = MsUtils.checkInteger(cellMargins.get("left"));
            int bottom = MsUtils.checkInteger(cellMargins.get("bottom"));
            int right = MsUtils.checkInteger(cellMargins.get("right"));
            table.setCellMargins(top, left, bottom, right);
        }
        int minRow = Math.min(rows, values.length);
        for (int i = 0; i < minRow; i++) {
            row = table.getRow(i);
            int height = i < rowHeight.length ? rowHeight[i] : rowHeight[rowHeight.length - 1];
            row.setHeight(height);
            String[] value = values[i];
            int minCol = Math.min(cols, value.length);
            for (int j = 0; j < minCol; j++) {
                cell = row.getCell(j);
                cellPr = cell.getCTTc().addNewTcPr();
                int width = j < colWidth.length ? colWidth[j] : colWidth[colWidth.length - 1];
                cellPr.addNewTcW().setW(BigInteger.valueOf(width));
                paragraph = cell.getParagraphs().get(0);
                int idx = i * cols + j;
                ParagraphAlignment align = idx < alignment.length ? alignment[idx] : alignment[alignment.length - 1];
                paragraph.setAlignment(align);
                run = paragraph.createRun();
                run.setText(value[j]);
                setStyle(run, styles);
            }
        }
    }
1004219
private void addAutoWidthExample() {
		add(new WHeading(HeadingLevel.H2, "Automatic (app defined) widths"));
		add(new ExplanatoryText("This example shows what happens if you use undefined (0) column width and do not then define them in CSS."));
		WPanel panel = new WPanel();
		panel.setLayout(new ColumnLayout(new int[]{0, 0, 0},
				new Alignment[]{Alignment.LEFT, Alignment.CENTER, Alignment.RIGHT}));
		add(panel);
		panel.add(new BoxComponent("Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."));
		panel.add(new BoxComponent("Praesent eu turpis convallis, fringilla elit nec, ullamcorper purus. Proin dictum ac nunc rhoncus fringilla. "
				+ "Pellentesque habitant morbi tristique senectus et netus et malesuada fames."));
		panel.add(new BoxComponent("Vestibulum vehicula a turpis et efficitur. Integer maximus enim a orci posuere, id fermentum magna dignissim. "
				+ "Sed condimentum, dui et condimentum faucibus, quam erat pharetra."));
		panel.add(new BoxComponent("Left"));
		panel.add(new BoxComponent("Center"));
		panel.add(new BoxComponent("Right"));
		add(new WHorizontalRule());
	}
762926
def add_columns(t0, t1):
    """"""

    for colname in t1.colnames:
        col = t1.columns[colname]
        if colname in t0.columns:
            continue
        new_col = Column(name=col.name, length=len(t0), dtype=col.dtype)  # ,
        # shape=col.shape)
        t0.add_column(new_col)
674632
function addAlignment(x, y) {
    var i;

    frameBuffer[x + width * y] = 1;

    for (i = -2; i < 2; i++) {
      frameBuffer[(x + i)     + width * (y - 2)]     = 1;
      frameBuffer[(x - 2)     + width * (y + i + 1)] = 1;
      frameBuffer[(x + 2)     + width * (y + i)]     = 1;
      frameBuffer[(x + i + 1) + width * (y + 2)]     = 1;
    }

    for (i = 0; i < 2; i++) {
      setMask(x - 1, y + i);
      setMask(x + 1, y - i);
      setMask(x - i, y - 1);
      setMask(x + i, y + 1);
    }
  }
413208
def combineColumns(cols):
    ''
    return Column("+".join(c.name for c in cols),
                  getter=lambda col,row,cols=cols,ch=' ': ch.join(c.getDisplayValue(row) for c in cols))
308724
def _with_columns(self, columns):
        """"""
        table = type(self)()
        for label, column in zip(self.labels, columns):
            self._add_column_and_format(table, label, column)
        return table
871214
function selectTab() {
        var href = tab.href.split('#')[1];
        var panel = layout._content.querySelector('#' + href);
        layout._resetTabState(tabs);
        layout._resetPanelState(panels);
        u.addClass(tab, layout._CssClasses.IS_ACTIVE);
        u.addClass(panel, layout._CssClasses.IS_ACTIVE);
    }
652346
def addcols(self, cols, names=None):
        
        data = spreadsheet.addcols(self, cols, names)
        data = data.view(tabarray)
        data.coloring = self.coloring
        return data
55110
function markdownTable(table, options) {
  var settings = options || {}
  var delimiter = settings.delimiter
  var start = settings.start
  var end = settings.end
  var alignment = settings.align
  var calculateStringLength = settings.stringLength || lengthNoop
  var cellCount = 0
  var rowIndex = -1
  var rowLength = table.length
  var sizes = []
  var align
  var rule
  var rows
  var row
  var cells
  var index
  var position
  var size
  var value
  var spacing
  var before
  var after

  alignment = alignment ? alignment.concat() : []

  if (delimiter === null || delimiter === undefined) {
    delimiter = SPACE + PIPE + SPACE
  }

  if (start === null || start === undefined) {
    start = PIPE + SPACE
  }

  if (end === null || end === undefined) {
    end = SPACE + PIPE
  }

  while (++rowIndex < rowLength) {
    row = table[rowIndex]

    index = -1

    if (row.length > cellCount) {
      cellCount = row.length
    }

    while (++index < cellCount) {
      position = row[index] ? dotindex(row[index]) : null

      if (!sizes[index]) {
        sizes[index] = MIN_CELL_SIZE
      }

      if (position > sizes[index]) {
        sizes[index] = position
      }
    }
  }

  if (typeof alignment === 'string') {
    alignment = pad(cellCount, alignment).split('')
  }

  /* Make sure only valid alignments are used. */
  index = -1

  while (++index < cellCount) {
    align = alignment[index]

    if (typeof align === 'string') {
      align = align.charAt(0).toLowerCase()
    }

    if (ALLIGNMENT.indexOf(align) === -1) {
      align = NULL
    }

    alignment[index] = align
  }

  rowIndex = -1
  rows = []

  while (++rowIndex < rowLength) {
    row = table[rowIndex]

    index = -1
    cells = []

    while (++index < cellCount) {
      value = row[index]

      value = stringify(value)

      if (alignment[index] === DOT) {
        position = dotindex(value)

        size =
          sizes[index] +
          (EXPRESSION_DOT.test(value) ? 0 : 1) -
          (calculateStringLength(value) - position)

        cells[index] = value + pad(size - 1)
      } else {
        cells[index] = value
      }
    }

    rows[rowIndex] = cells
  }

  sizes = []
  rowIndex = -1

  while (++rowIndex < rowLength) {
    cells = rows[rowIndex]

    index = -1

    while (++index < cellCount) {
      value = cells[index]

      if (!sizes[index]) {
        sizes[index] = MIN_CELL_SIZE
      }

      size = calculateStringLength(value)

      if (size > sizes[index]) {
        sizes[index] = size
      }
    }
  }

  rowIndex = -1

  while (++rowIndex < rowLength) {
    cells = rows[rowIndex]

    index = -1

    if (settings.pad !== false) {
      while (++index < cellCount) {
        value = cells[index]

        position = sizes[index] - (calculateStringLength(value) || 0)
        spacing = pad(position)

        if (alignment[index] === RIGHT || alignment[index] === DOT) {
          value = spacing + value
        } else if (alignment[index] === CENTER) {
          position /= 2

          if (position % 1 === 0) {
            before = position
            after = position
          } else {
            before = position + 0.5
            after = position - 0.5
          }

          value = pad(before) + value + pad(after)
        } else {
          value += spacing
        }

        cells[index] = value
      }
    }

    rows[rowIndex] = cells.join(delimiter)
  }

  if (settings.rule !== false) {
    index = -1
    rule = []

    while (++index < cellCount) {
      /* When `pad` is false, make the rule the same size as the first row. */
      if (settings.pad === false) {
        value = table[0][index]
        spacing = calculateStringLength(stringify(value))
        spacing = spacing > MIN_CELL_SIZE ? spacing : MIN_CELL_SIZE
      } else {
        spacing = sizes[index]
      }

      align = alignment[index]

      /* When `align` is left, don't add colons. */
      value = align === RIGHT || align === NULL ? DASH : COLON
      value += pad(spacing - 2, DASH)
      value += align !== LEFT && align !== NULL ? COLON : DASH

      rule[index] = value
    }

    rows.splice(1, 0, rule.join(delimiter))
  }

  return start + rows.join(end + NEW_LINE + start) + end
}
454988
def rowcol_from_template(target_tab, template_tab=0):
	

	for row, tab in S.row_heights.keys():
		# Delete all row heights in target table
		if tab == target_tab:
			S.row_heights.pop((row, tab))

		if tab == template_tab:
			S.row_heights[(row, target_tab)] = \
				S.row_heights[(row, tab)]

	for col, tab in S.col_widths.keys():
		# Delete all column widths in target table
		if tab == target_tab:
			S.col_widths.pop((col, tab))

		if tab == template_tab:
			S.col_widths[(col, target_tab)] = \
					S.col_widths[(col, tab)]

	return "Table {tab} adjusted.".format(tab=target_tab)