public static String renderTextTable(Table table, boolean withHeader) {

		table.calculateColumnWidths();

		final String padding = "  ";
		final String headerBorder = getHeaderBorder(table.getHeaders());
		final StringBuilder textTable = new StringBuilder();

		if (withHeader) {
			final StringBuilder headerline = new StringBuilder();
			for (TableHeader header : table.getHeaders().values()) {

				if (header.getName().length() > header.getWidth()) {
					Iterable<String> chunks = Splitter.fixedLength(header.getWidth()).split(header.getName());
					int length = headerline.length();
					boolean first = true;
					for (String chunk : chunks) {
						final String lineToAppend;
						if (first) {
							lineToAppend = padding + CommonUtils.padRight(chunk, header.getWidth());
						}
						else {
							lineToAppend = StringUtils.leftPad("", length) + padding
									+ CommonUtils.padRight(chunk, header.getWidth());
						}
						first = false;
						headerline.append(lineToAppend);
						headerline.append("\n");
					}
					headerline.deleteCharAt(headerline.lastIndexOf("\n"));
				}
				else {
					String lineToAppend = padding + CommonUtils.padRight(header.getName(), header.getWidth());
					headerline.append(lineToAppend);
				}
			}
			textTable.append(org.springframework.util.StringUtils.trimTrailingWhitespace(headerline.toString()));
			textTable.append("\n");
		}

		textTable.append(headerBorder);

		for (TableRow row : table.getRows()) {
			StringBuilder rowLine = new StringBuilder();
			for (Entry<Integer, TableHeader> entry : table.getHeaders().entrySet()) {
				String value = row.getValue(entry.getKey());
				if (null != value && (value.length() > entry.getValue().getWidth())) {
					Iterable<String> chunks = Splitter.fixedLength(entry.getValue().getWidth()).split(value);
					int length = rowLine.length();
					boolean first = true;
					for (String chunk : chunks) {
						final String lineToAppend;
						if (first) {
							lineToAppend = padding + CommonUtils.padRight(chunk, entry.getValue().getWidth());
						}
						else {
							lineToAppend = StringUtils.leftPad("", length) + padding
									+ CommonUtils.padRight(chunk, entry.getValue().getWidth());
						}
						first = false;
						rowLine.append(lineToAppend);
						rowLine.append("\n");
					}
					rowLine.deleteCharAt(rowLine.lastIndexOf("\n"));
				}
				else {
					String lineToAppend = padding + CommonUtils.padRight(value, entry.getValue().getWidth());
					rowLine.append(lineToAppend);
				}
			}
			textTable.append(org.springframework.util.StringUtils.trimTrailingWhitespace(rowLine.toString()));
			textTable.append("\n");
		}

		if (!withHeader) {
			textTable.append(headerBorder);
		}

		return textTable.toString();
	}
Renders a textual representation of the provided {@link Table}

@param table Table data {@link Table}
@return The rendered table representation as String
spring-xd-shell/src/main/java/org/springframework/xd/shell/util/UiUtils.java