Several implementations of a text table, originally using ASCII and UTF-8 characters for borders.

Related tags

CLI asciitable
Overview

ASCII Table

ASCII table - A simple tool to format tables with various row/column options for indentation, indentation character, alignment, padding (left, right, both), padding characters (left, right, both), and in-line whitespace characters.

Resources

Home page

site

Source repository

Github

Maven Central current release

current release 0.3.2

Maven Central all releases

all releases

Java 7 legacy version source repository

GitHub

Java 7 legacy version Maven releases

Maven Central

UTF-8 Howto, older blog

older blog

UTF-8 Howto, updated Wiki

updated SKB Wiki

Installation

Maven

For Maven declare a dependency in the <dependencies> section of your POM file.

Dependency declaration in pom.xml
<dependency>
    <groupId>de.vandermeer</groupId>
    <artifactId>asciitable</artifactId>
    <version>0.3.2</version>
</dependency>

Gradle / Grails

compile 'de.vandermeer:asciitable:0.3.2'

For other build systems see Maven Central

Features

Text table with some flexibility for rules and content, alignment, format, padding, margins, and frames:

  • add text, as often as required in many different formats (string, text provider, render provider, ST, clusters),

  • removes all excessive white spaces (tabulators, extra blanks, combinations of carriage return and line feed),

  • 6 different text alignments: left, right, centered, justified, justified last line left, justified last line right,

  • flexible width, set for text and calculated in many different ways for rendering

  • padding characters for left and right padding (configurable separately)

  • padding characters for top and bottom padding (configurable separately)

  • several options for drawing grids

  • rules with different styles (as supported by the used grid theme: normal, light, strong, heavy)

  • top/bottom/left/right margins outside a frame

  • character conversion to generated text suitable for further process, e.g. for LaTeX and HTML

Concepts

The main concepts are: table, table context, and table renderer.

Anatomy of a table

The figure below shows all spacing characteristics of a table. The outer rectangle (using +, -, and | characters) marks the most outer part of a table. This is followed by top, bottom, left, and right frame margins.

The next rectangle (using the UTF-8 double line characters) shows an example grid. Inside the grid 4 rows with different column spans are shown.

+--------------------------------------------------------------------------------------------+
|                                                                                            |
|                                      Top Frame Margin                                      |
|                                                                                            |
|        ╔════════════════════════╦════════════════════════╦════════════════════════╗        |
|        ║ row 1 col 1 / cell 1,1 ║ row 1 col 2 / cell 1,2 ║ row 1 col 3 / cell 1,3 ║        |
|  F  M  ╠════════════════════════╩════════════════════════╬════════════════════════╣  F  M  |
|  r  a  ║            row 2 col 1&2 / cell 1,1/2           ║ row 2 col 3 / cell 1,3 ║  r  a  |
|  a  r  ╠════════════════════════╦════════════════════════╩════════════════════════╣  a  r  |
|  m  g  ║ row 3 col 1 / cell 1,1 ║            row 2 col 2&3 / cell 1,2/3           ║  m  g  |
|  e  i  ╠════════════════════════╩═════════════════════════════════════════════════╣  e  i  |
|     n  ║                      row 4 col 1&2&3 / cell 1,1/2/3                      ║     n  |
|        ╚══════════════════════════════════════════════════════════════════════════╝        |
|                                                                                            |
|                                     Bottom Frame Margin                                    |
|                                                                                            |
+--------------------------------------------------------------------------------------------+

The next figure shows the anatomy of a single table cell. The core is the text in the middle. Top and bottom padding can be added (whole lines before and after the text). Left and right padding can be added to the text.

╔══════════════════════════════╗
║          Top Padding         ║
║------------------------------║
║ Left    |   cell   |   Right ║
║ Padding |   text   | Padding ║
║------------------------------║
║        Bottom Padding        ║
╚══════════════════════════════╝

Table

A paragraph is a collection of text strings. The strings are processed as follows:

  • add text to the paragraph, multiple times if required

  • the paragraph will separate each added text using a space

  • for rendering a paragraph, all excessive white spaces will be removed

    • tabulators (converted to spaces),

    • more than one consecutive space,

    • line feed,

    • carriage return, and

    • line feed and carriage return.

Format of a paragraph

Paragraphs can be formatted using a number of special formats. Currently implemented are

  • First line - an indentation for the first line of the paragraph

  • Hanging paragraph - an indentation for everything but the first line

  • Dropped capital letter - a large capital letter for the first character of the first sentence spanning multiple lines

Text alignment

Text in the paragraph can be aligned in multiple different ways:

  • align left (open ended right site)

  • align right (open ended left site)

  • centered (all lines centered)

  • justified (all line justified)

  • justified with last line left aligned

  • justified with last line right aligned

Text padding

All lines will use padding to create a paragraph with equal length of each line. The padding on the left and the right depends on the text alignment:

  • align left: no padding left (all lines bound), padding on the right

  • align right: no padding on the right (all lines bound), padding on the right

  • centered: padding on both sides of each line

  • justified: no padding at all, each line starts and finishes with a word (or single character)

  • justified last line left align: padding only for the last line, on the right site

  • justified last line right align: padding only for the last line, on the left site

The characters being used for padding can be set separately, so that each site of a line gets a different padding character.

In-text white spaces

With all excessive white spaces removed, each line only contains single blanks. The exception to this rule are all justified paragraphs (here extra white spaces are added to give the impression of a justified paragraph).

The implementation allows to change the character used for in-text white spaces from the default (a blank) to any other character.

Start and end strings

Each line of a paragraph can be started and terminated by a specific (different or identical) string. These strings are outside the text area, i.e. no special formatting is done on those strings.

Margins

A paragraph has several margins for the left and right sides as well as for top and bottom. Each margin can be set - the width for let/right side margins and the height for top and bottom margins. Additionally, a character can be set for left/right margins (the same or different characters for each side).

Frame

A paragraph can also be framed. A frame is

  • a line above the paragraph,

  • borders for each line of the paragraph (on the left and right side),

  • and a line at the bottom of of the paragraph.

The frame is set as a frame theme. A number of those themes are provided in the skb-interfaces package. New themes can be created very easily, using ASCII and/or UTF-8 characters.

Summary of configurable characteristics

  • text width (length of each text line)

  • text alignment (for the whole paragraph): left, right, centered, justified (with additional options for last line)

  • text format: first line, hanging, dropped capital letter

  • frame: set a frame around the paragraph

  • start / end string: define a start and/or end string for each line

  • top and bottom margins above a frame (empty lines)

  • margins on the left and right of a frame (number with character)

  • margins between the frame and the start string (left) and end string and frame (right), using different length and character

  • margins between start string and text (left), and text and end string (right), using different length and characters

  • top and bottom margins for the text (including and string margin and string)

  • character converters to convert characters before line generation, i.e. to generate text suitable for LaTeX or HTML

Context

While the paragraph only maintains the text, the paragraph context maintains all configurable characteristics of the paragraph (see above). The current implementation directly has

  • paragraph alignment (default being justified, last line left)

  • paragraph format (default being none)

  • paragraph width (default being 80)

  • an optional library for dropped capital letters (default being not set)

  • an optional theme for a frame (default being not set)

The following characteristics are handled by special objects (one for each), which the context provides access to:

  • indentations (for first line and hanging paragraph)

  • all margins

  • all characters

  • all strings

  • all character (and target) translators

Additionally, the context provides a number of helper methods for rendering

  • different calculations for width, starting with simple text width and finishing with an all inclusive width

  • convenience methods to jointly set margins and characters, for the same left/right or top/bottom pairs

The paragraph can be initialized with a given context or plain, in which case it will create its own context object. Any future characteristics will be added to the paragraph context

Renderer

The actual rendering of a paragraph is realized by special render objects (i.e. it’s not done in the paragraph or its context). A paragraph can be rendered in two different ways:

  1. call the provided render methods on the paragraph object itself

  2. use a specialized render object

No changes are made to the paragraph text or any context settings by any render operation. All required text being processed and calculations being made will happen inside the renderer.

The render methods on the paragraph allow to render it (a) to the width set in the context or (b) to an overall required width. The first option is the most simple one: fill paragraph with text, set width on context, render. The second option can be used by other applications, for instance a table, to get a paragraph of required width.

For any other render operations use the provided standard renderer or create your own render object. The default renderer does currently provide render methods to different width with calculations provided by the context.

Note: coming soon: It also provides render methods that use their own context (i.e. ignore the context set in the paragraph). This allows for extremely flexibility in using the paragraph in many different scenarios.

Getting Started

The standard usage is:

  • create a table

  • add content (rows and cells) to the table

  • change the table context (to change its properties)

  • render the table

  • use the created string, e.g. print it to a console or write it to a file

First, create a table.

AsciiTable at = new AsciiTable();

Next, add content (rows and cells). Any text can be added, the renderer will process the text (for instance remove excessive white spaces).

at.addRule();
at.addRow("row 1 col 1", "row 1 col 2");
at.addRule();
at.addRow("row 2 col 1", "row 2 col 2");
at.addRule();

Next, render the table. This will provide the text output using the default settings from the table’s context.

String rend = at.render()

Finally, print the table to standard out.

System.out.println(rend);

The output will be:

┌───────────────────────────────────────┬──────────────────────────────────────┐
│row 1 col 1                            │row 1 col 2                           │
├───────────────────────────────────────┼──────────────────────────────────────┤
│row 2 col 1                            │row 2 col 2                           │
└───────────────────────────────────────┴──────────────────────────────────────┘

Examples

The following examples are using the classic "Lorem Ipsum" text as content.

Width

Width of 50, 40, and 30 on the same table.

┌────────────────────────┬───────────────────────┐
│row 1 col 1             │row 1 col 2            │
├────────────────────────┼───────────────────────┤
│row 2 col 1             │row 2 col 2            │
└────────────────────────┴───────────────────────┘

┌───────────────────┬──────────────────┐
│row 1 col 1        │row 1 col 2       │
├───────────────────┼──────────────────┤
│row 2 col 1        │row 2 col 2       │
└───────────────────┴──────────────────┘

┌──────────────┬─────────────┐
│row 1 col 1   │row 1 col 2  │
├──────────────┼─────────────┤
│row 2 col 1   │row 2 col 2  │
└──────────────┴─────────────┘

Columns

The number of columns a table supports is determined by the first content row added. Here are tables with columns ranging from 1 to 5

┌────────────────────────────┐
│Table Heading               │
├────────────────────────────┤
│first row (col1)            │
├────────────────────────────┤
│second row (col1)           │
└────────────────────────────┘

┌───────────────────────────────┬───────────────────────────────┐
│first row (col1)               │some information (col2)        │
├───────────────────────────────┼───────────────────────────────┤
│second row (col1)              │some information (col2)        │
└───────────────────────────────┴───────────────────────────────┘

┌──────────────────────────┬─────────────────────────┬─────────────────────────┐
│first row (col1)          │some information (col2)  │more info (col3)         │
├──────────────────────────┼─────────────────────────┼─────────────────────────┤
│second row (col1)         │some information (col2)  │more info (col3)         │
└──────────────────────────┴─────────────────────────┴─────────────────────────┘

┌───────────────────┬───────────────────┬───────────────────┬──────────────────┐
│first row (col1)   │text (col2)        │more text (col3)   │even more (col4)  │
├───────────────────┼───────────────────┼───────────────────┼──────────────────┤
│second row (col1)  │text (col2)        │more text (col3)   │even more (col4)  │
└───────────────────┴───────────────────┴───────────────────┴──────────────────┘

┌───────────────┬───────────────┬───────────────┬───────────────┬──────────────┐
│row1 (col1)    │text (col2)    │text (col3)    │text (col4)    │text (col5)   │
├───────────────┼───────────────┼───────────────┼───────────────┼──────────────┤
│row2 (col1)    │text (col2)    │text (col3)    │text (col4)    │text (col5)   │
└───────────────┴───────────────┴───────────────┴───────────────┴──────────────┘

Column Span

The table supports column spans

┌─────────────────────────────────────────────────────────────────────┐
│span all 5 columns                                                   │
├───────────────────────────────────────────────────────┬─────────────┤
│span 4 columns                                         │just 1 column│
├─────────────────────────────────────────┬─────────────┴─────────────┤
│span 3 columns                           │span 2 columns             │
├───────────────────────────┬─────────────┴───────────────────────────┤
│span 2 columns             │span 3 columns                           │
├─────────────┬─────────────┴─────────────────────────────────────────┤
│just 1 column│span 4 columns                                         │
├─────────────┼─────────────┬─────────────┬─────────────┬─────────────┤
│just 1 column│just 1 column│just 1 column│just 1 column│just 1 column│
└─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘

Text Alignment

Text in cells can be aligned in different ways: justified left, justified, justified right, left, center right. The text alignment can be set on the whole table, a row, or individual cells.

┌─────────────────────────┬─────────────────────────┬─────────────────────────┐
│Lorem  ipsum  dolor   sit│Lorem  ipsum  dolor   sit│Lorem  ipsum  dolor   sit│
│amet,          consetetur│amet,          consetetur│amet,          consetetur│
│sadipscing   elitr,   sed│sadipscing   elitr,   sed│sadipscing   elitr,   sed│
│diam nonumy eirmod tempor│diam nonumy eirmod tempor│diam nonumy eirmod tempor│
│invidunt  ut  labore   et│invidunt  ut  labore   et│invidunt  ut  labore   et│
│dolore magna             │dolore              magna│             dolore magna│
├─────────────────────────┼─────────────────────────┼─────────────────────────┤
│Lorem ipsum dolor sit    │  Lorem ipsum dolor sit  │    Lorem ipsum dolor sit│
│amet, consetetur         │    amet, consetetur     │         amet, consetetur│
│sadipscing elitr, sed    │  sadipscing elitr, sed  │    sadipscing elitr, sed│
│diam nonumy eirmod tempor│diam nonumy eirmod tempor│diam nonumy eirmod tempor│
│invidunt ut labore et    │  invidunt ut labore et  │    invidunt ut labore et│
│dolore magna             │      dolore magna       │             dolore magna│
└─────────────────────────┴─────────────────────────┴─────────────────────────┘

Padding

Padding can be added to text in cells above (top) and below (bottom) the text or in front (left) or behind (right) each line. The character for the padding can be set separately.

┌───────────────┬───────────────┐
│vvvvvvvvvvvvvvv│vvvvvvvvvvvvvvv│
│> row 1 col 1 <│> row 1 col 2 <│
│^^^^^^^^^^^^^^^│^^^^^^^^^^^^^^^│
├───────────────┼───────────────┤
│vvvvvvvvvvvvvvv│vvvvvvvvvvvvvvv│
│> row 2 col 1 <│> row 2 col 2 <│
│^^^^^^^^^^^^^^^│^^^^^^^^^^^^^^^│
└───────────────┴───────────────┘

Margins

Margins cen be set outside the grid (top, bottom, left, right). Margins and the character used for rendering the margin can be set separately.

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
>>>┌───────────┬───────────┐<<<<
>>>│row 1 col 1│row 1 col 2│<<<<
>>>├───────────┼───────────┤<<<<
>>>│row 2 col 1│row 2 col 2│<<<<
>>>└───────────┴───────────┘<<<<
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Grids

Grids are used to draw a frame around cells. The implementation used TA_Grid objects from the ascii-utf-themes package.

┌─────┬─────┐      +-----+-----+      ═════════════      ╒═════╤═════╕      ╔═════╦═════╗
│rc 11│rc 12│      |rc 11|rc 12|       rc 11 rc 12       │rc 11│rc 12│      ║rc 11║rc 12║
├─────┼─────┤      +-----+-----+      ═════════════      ╞═════╪═════╡      ╠═════╬═════╣
│rc 21│rc 22│      |rc 21|rc 22|       rc 21 rc 22       │rc 21│rc 22│      ║rc 21║rc 22║
└─────┴─────┘      +-----+-----+      ═════════════      ╘═════╧═════╛      ╚═════╩═════╝

Grids: Rule Styles

Grids can support different rule styles, thus supporting normal, light, strong, and heavy table rules.

═════════════
 rc 11 rc 12
─────────────
 rc 21 rc 22
▓▓▓▓▓▓▓▓▓▓▓▓▓
 rc 31 rc 32
▀▀▀▀▀▀▀▀▀▀▀▀▀

Grids: Themes

Grids support different themes. A grid theme defines which grid characters from which position should be rendered. All other character will be rendered using a default character, usually blank.

┌─────┬─────┐                         ┌           ┐      ┌     ┬     ┐       ───────────
│rc 11│rc 12│       rc 11 rc 12        rc 11 rc 12        rc 11 rc 12        rc 11 rc 12
├─────┼─────┤                                            ├     ┼     ┤       ───────────
│rc 21│rc 22│       rc 21 rc 22        rc 21 rc 22        rc 21 rc 22        rc 21 rc 22
└─────┴─────┘                         └           ┘      └     ┴     ┘       ───────────

                                      ┌───────────┐                          ───────────
│rc 11│rc 12│       rc 11│rc 12       │rc 11 rc 12│      │rc 11 rc 12        rc 11 rc 12
│     │     │       ─────┼─────       │           │      │
│rc 21│rc 22│       rc 21│rc 22       │rc 21 rc 22│      │rc 21 rc 22        rc 21 rc 22
                                      └───────────┘                          ───────────

Grids: New Grids

New grids can be easily defined and applied to a table.

#############
&rc 11&rc 12&
+#####+#####+
&rc 21&rc 22&
%#####%#####%

Special Input

URIs

Uniform Resource Identifiers (URIs) can be used in a table. No special rules are applied to them for line breaks. The renderer tries to put as many characters of a URI into a single line as possible.

┌───────────────────────────────────┬───────────────────────────────────┐
│scheme:[//[user:password@]host[:por│scheme:[//[user:password@]host[:por│
│t]][/]path[?query][#fragment]      │t]][/]path[?query][#fragment]      │
├───────────────────────────────────┴───────────────────────────────────┤
│scheme:[//[user:password@]host[:port]][/]path[?query][#fragment]       │
├───────────────────────────────────┬───────────────────────────────────┤
│abc://username:[email protected]│abc://username:[email protected]│
│:123/path/data?key=value#fragid1   │:123/path/data?key=value#fragid1   │
├───────────────────────────────────┴───────────────────────────────────┤
│abc://username:[email protected]:123/path/data?key=value#fragid1    │
├───────────────────────────────────┬───────────────────────────────────┤
│urn:example:mammal:monotreme:echidn│urn:example:mammal:monotreme:echidn│
│a                                  │a                                  │
├───────────────────────────────────┴───────────────────────────────────┤
│urn:example:mammal:monotreme:echidna                                   │
├───────────────────────────────────┬───────────────────────────────────┤
│http://www.example.com/test1/test2 │http://www.example.com/test1/test2 │
├───────────────────────────────────┴───────────────────────────────────┤
│http://www.example.com/test1/test2                                     │
├───────────────────────────────────┬───────────────────────────────────┤
│mailto:[email protected]           │mailto:[email protected]│
│                                   │om                                 │
├───────────────────────────────────┴───────────────────────────────────┤
│mailto:[email protected]                                  │
└───────────────────────────────────────────────────────────────────────┘

Conditional Linebreaks

With all excessive white spaces being removed, conditional line breaks in a cell need to be done using a markup. The implementation recognizes the two HTML line break markups <br> and <br />.

┌────────────────────────────────────────────────┐
│line 1                                          │
│line 2                                          │
│line three still line three                     │
└────────────────────────────────────────────────┘

Lists using Conditional Linebreaks

┌────────────────────┬─────────────────────────┐
│column with a list  │* list item one          │
│using conditional   │* list item two          │
│line breaks         │* list item three        │
└────────────────────┴─────────────────────────┘

Target translator for LaTeX character conversion

Left column w/o and right column with LaTeX target converter:

┌───────────────────────────────────────┬──────────────────────────────────────┐
│A sentence with some normal text, not  │A sentence with some normal text, not │
│specific to LaTeX. Now for some        │specific to LaTeX. Now for some       │
│characters that require conversion: # %│characters that require conversion: \#│
│&. And some more: © § ¤. And even more:│\% \&. And some more: {\copyright}    │
│È É Ê Ë. And some arrows as well: ← ↑ →│{\S} \currency. And even more: \`{E}  │
│↓ ↔                                    │\'{E} \^{E} \"{E}. And some arrows as │
│                                       │well: \(\leftarrow{}\) \(\uparrow\)   │
│                                       │\(\rightarrow{}\) \(\downarrow{}\)    │
│                                       │\(\leftrightarrow{}\)                 │
└───────────────────────────────────────┴──────────────────────────────────────┘

Target translator for HTML character conversion

Left column w/o and right column with HTML target converter

┌───────────────────────────────────────┬──────────────────────────────────────┐
│A sentence with some normal text, not  │A sentence with some normal text, not │
│specific to HTML. Now for some         │specific to HTML. Now for some        │
│characters that require conversion: # %│characters that require conversion:   │
│& < >. And some more: © § ¤. And even  │&#803; &#37; &amp; &lt; &gt;. And some│
│more: Ē ē Ĕ ĕ Ė ė Ę ę Ě ě. And some    │more: &copy; &sect; &curren;. And even│
│arrows as well: ← ↑ → ↓ ↔ ↕            │more: &#274; &#275; &#276; &#277;     │
│                                       │&#278; &#279; &#280; &#281; &#282;    │
│                                       │&#283;. And some arrows as well:      │
│                                       │&larr; &uarr; &rarr; &darr; &harr;    │
│                                       │&#8597;                               │
└───────────────────────────────────────┴──────────────────────────────────────┘
Comments
  • I did not find a suitable theme

    I did not find a suitable theme

    The library is very cool, but still I could not find a suitable theme for the table. And it must have been just to have all the boundaries except the top and bottom. Tried to combine through GridOptions, but it did not work out yet. Do not tell me how it can be done?

    | cell | cell | |-------------| | cell | cell | |-------------| | cell | cell |

    opened by i-panov 4
  • How to do span, content into list, etc in the example ?

    How to do span, content into list, etc in the example ?

    Would be nice to copy snippets of code along with the output in the main page examples !

    I've tried looking at your test/ and also autocomplete from my ide on the table, row, renderer, etc, but cannot seem to find the way to do column spanning, content becoming a list, etc.

    Thanks.

    opened by albert-kam 4
  • added WidthLongestLine

    added WidthLongestLine

    Hi, the WidthLongestLine class calculates the width of each column based on the cell with the longest line. It also supports additional definition of min/max column widths.

    It already takes in account cells containing line breaks, which works best when https://github.com/vdmeer/asciitable/issues/2 is fixed.

    Regards, Seb

    opened by sebthom 4
  • [#8] added configurable line separator option to AT_Context

    [#8] added configurable line separator option to AT_Context

    • Solves #8 by adding a configurable line separator String to AT_Context.
    • The new field AT_Context.lineSeparator replaces the hardcoded one in AsciiTable and AT_Rendeder.
    • Naturally this needs to be a String instead of char, because MsWin would use \r\n.
    • The default separator is \n to stay compatible with previous versions.
    opened by stuchl4n3k 3
  • Emails not displayed correctly

    Emails not displayed correctly

    Hi,

    If I try to print an email in the content, the "at" character is translated to a new line. The problem seems to be in method

    de.vandermeer.asciitable.commons.ArrayTransformations.WRAP_LINES(int, Object)

    opened by jpuerto 3
  • Respect new line breaks in cells

    Respect new line breaks in cells

    The following code:

        final V2_AsciiTable at = new V2_AsciiTable();
        at.addRule();
        at.addRow("request", "status", "causes");
        at.addRule();
        at.addRow("1", "invalid", "* size limit exceeded\n* invalid characters found");
        at.addRule();
        at.addRow("2", "valid", "* all requirements satisfied");
        at.addRule();
        final V2_AsciiTableRenderer rend = new V2_AsciiTableRenderer();
        rend.setTheme(V2_E_TableThemes.PLAIN_7BIT.get());
        rend.setWidth(new WidthFixedColumns().add(10).add(10).add(40));
        final RenderedTable rt = rend.render(at);
        System.out.println(rt);
    

    results in:

    +----------+----------+----------------------------------------+
    | request  | status   | causes                                 |
    +----------+----------+----------------------------------------+
    | 1        | invalid  | * size limit exceeded
    * invalid        |
    |          |          | characters found                       |
    +----------+----------+----------------------------------------+
    | 2        | valid    | * all requirements satisfied           |
    +----------+----------+----------------------------------------+
    

    but should result in:

    +----------+----------+----------------------------------------+
    | request  | status   | causes                                 |
    +----------+----------+----------------------------------------+
    | 1        | invalid  | * size limit exceeded                  |
    |          |          | * invalid characters found             |
    +----------+----------+----------------------------------------+
    | 2        | valid    | * all requirements satisfied           |
    +----------+----------+----------------------------------------+
    
    opened by sebthom 3
  • Code for Examples

    Code for Examples

    On the main page, there are several examples of what AsciiTable can do. Please add the code necessary to create such a table. It took me a while to figure out where the grids are created and how to set the grid into the table.

    opened by numeralnathan 2
  • Add configurable line separator

    Add configurable line separator

    Problem:

    • Tables generated on Linux cannot be displayed properly on MsWin (e.g. notepad).
    • Line separator is hardcoded (e.g. AsciiTable.render()).

    Suggested solution:

    • Use System.lineSeparator() instead of hardcoded "\n" in table rendering.
    • And/or allow configuration of the separator per table instance.

    Workaround:

    String asciiTableRenderWithPlatformSeparator(AsciiTable table) {
            return new StrBuilder().appendWithSeparators(
                table.getRenderer().render(table.getRawContent(), table.getColNumber(), table.getContext()), System.lineSeparator()
            ).toString();
    }
    
    opened by stuchl4n3k 2
  • Table rendered with question marks instead '-' symbols?

    Table rendered with question marks instead '-' symbols?

    Hi,

    Why the table rendered with question marks instead '-' symbols? Locally all works, but wjen I deploy my application to azure I have this strange output ???????????????????????????????????????????????????????????????????????????????????????????? ? detailed solution ? ????????????????????????????????????????????????????????????????????????????????????????????

    opened by ifle 1
  • Null tolerant rendering of rows (#14)

    Null tolerant rendering of rows (#14)

    Fixes #14, where rendering crashes if a row contains any null value. The placeholder for null values can be configured using the nullValuePlaceholder property of a table context, by default set to empty String.

    opened by todvora 1
  • IndexOutOfBoundsException

    IndexOutOfBoundsException

    Today I got an IOOB Exception, the code should either check for such condition and give meaningful error message if it is an user error or do not fail.

    java.lang.IndexOutOfBoundsException: Index 135 out of bounds for length 135
    	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
    	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
    	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
    	at java.base/java.util.Objects.checkIndex(Objects.java:359)
    	at java.base/java.util.ArrayList.get(ArrayList.java:427)
    	at de.vandermeer.asciithemes.TA_GridHelpers.adjustBorder(TA_GridHelpers.java:194)
    	at de.vandermeer.asciithemes.TA_Grid.addGrid(TA_Grid.java:306)
    	at de.vandermeer.asciitable.AT_Renderer.renderAsCollection(AT_Renderer.java:282)
    	at de.vandermeer.asciitable.AsciiTable.renderAsCollection(AsciiTable.java:207)
    	at de.vandermeer.skb.interfaces.render.RendersToClusterWidth.renderAsIterator(RendersToClusterWidth.java:52)
    
    opened by laeubi 1
  • Support for colored text content

    Support for colored text content

    Thank you for the amazing work and the great library! It would be very nice if there would be a way to color the text of specific rows/columns/cells.

    I already tried to combine it with Chalk (https://github.com/tomas-langer/chalk) but asciitable does not render the color correctly (some of the special utf characters are printed).

    This would be great for content with totals, warnings, etc.

    opened by thomasrepnik 1
  • Markdown table style

    Markdown table style

    It would be useful a predefined table style to render tables as Markdown. The use case is that the output created with AsciiTable would be used to enrich documentation in Markdown format.

    opened by mbigatti 0
  • addRow - empty/null strategy

    addRow - empty/null strategy

    What I have found while using this library (thank you for making it anyway!) is that when I might add some data to AsciiTable by using method addRow which might be empty/null, would be good to define an additionally empty/null strategy if data passed to this method is empty/null, aka default fallback option

    opened by GarciaPL 0
  • About Java 7 Support

    About Java 7 Support

    I am getting this error:

    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/builder/ToStringBuilder at de.vandermeer.asciitable.v2.row.RuleRow.toString(RuleRow.java:101) at de.vandermeer.asciitable.v2.row.RuleRow.toString(RuleRow.java:109)

    I have Commons Lang 2.6, this library requires 3, then, its requiere java 8. Am I forgetting something?

    Thanks.

    opened by steelcorsy 1
Owner
Sven van der Meer
Sven van der Meer
Java library for creating text-based GUIs

Lanterna Lanterna is a Java library allowing you to write easy semi-graphical user interfaces in a text-only environment, very similar to the C librar

null 2k Dec 31, 2022
JCLR (JavaColor) is a library that allows you to write colored text in your terminal. It use the ANSI color system. Go check the README.md file to see how to use it.

JCLR JCLR (JavaColor) is a library that allows you to write colored text in your terminal. It use the ANSI color system. To start using it, go to the

Scythe 3 Aug 21, 2021
Command-line API for Atlassian JIRA using the Tomitribe CREST library

Atlassian JIRA Command-Line (CLI) Jamira is a command-line API for Atlassian JIRA using the Tomitribe CREST library. Installation Jamira can be downlo

Tomitribe 12 Sep 10, 2022
AWS JSON TRANSLATOR CLI is a command line application to translate JSON files using AWS Translate

A command line tool to translate JSON files using AWS Translate.

Marc Guillem 0 May 30, 2022
Mp4grep - a CLI for transcribing and searching audio/video files

mp4grep mp4grep is a tool that transcribes and searches audio and video files for a regex pattern. mp4grep isn't just for mp4 files! It also supports

ooc 250 Dec 23, 2022
Wrapper around ping command for Windows and MacOS

Wrapper around ping command for Windows and MacOS. Extended with functionality to intercept results provided by the ping command output (latency, ttl and etc.)

Vladislav Kozlov 1 Jan 6, 2022
TransitScheduler - a command line tool that can read .json data formulated for tracking transit patterns to a multithreaded concurrent simulation of passengers boarding and unboarding trains that constantly move to the next station on the line. The trick here, is that two trains cannot occupy the same station at any time.

TransitScheduler - a command line tool that can read .json data formulated for tracking transit patterns to a multithreaded concurrent simulation of passengers boarding and unboarding trains that constantly move to the next station on the line. The trick here, is that two trains cannot occupy the same station at any time.

Emmet Hayes 1 Dec 2, 2022
Usign ascii characters, recreate an image following a local path

CMDImage Usign ascii characters, recreate an image following a local path README El código toma una imagen desde una ruta local para convertirlo en ca

Alexander Hernández 13 Aug 30, 2022
OBKV Table Client is Java Library that can be used to access table data from OceanBase storage layer.

OBKV Table Client OBKV Table Client is Java Library that can be used to access table data from OceanBase storage layer. Its access method is different

OceanBase 12 Dec 16, 2022
A VisionCamera Frame Processor Plugin to preform text detection on images using MLKit Vision Text Recognition

vision-camera-ocr A VisionCamera Frame Processor Plugin to preform text detection on images using MLKit Vision Text Recognition. Installation yarn add

Aaron Grider 133 Dec 19, 2022
Repository to keep up with ViaVersion on MCP (Originally from https://github.com/LaVache-FR/ViaMCP)

ViaMCP-Reborn Repository to keep up with ViaVersion on MCP (Originally from https://github.com/LaVache-FR/ViaMCP) 1.7.x Protocols Yes, i know they are

null 109 Dec 28, 2022
evilzip lets you create a zip file(with password) that contains files with directory traversal characters in their embedded path.

evilzip logs 20210701 修改权限问题,让解压后的文件默认就有读写执行的权限。 About evilzip lets you create a zip file(with password) that contains files with directory traversal

鸭王 87 Dec 11, 2022
EssentialClient is a client side mod originally forked from Carpet Client for 1.15.2 that implements new client side features

EssentialClient EssentialClient is a client side only mod originally forked from Carpet Client for 1.15.2 that implements new client side features. Th

null 62 Jan 3, 2023
RT4 client originally compiled on Jan 28, 2009 (530)

Goals Identify all classes Create new static classes by grouping related members Identify all methods Identify all fields Identify all local variables

Pazaz 10 Nov 14, 2022
Set level of characters in-game

SetLevel Basics This is a simple plugin to easily set character level in game. There will probably be issues if you don't use the commands as intended

Thoronium 15 Dec 16, 2022
ASCII renderer in pure java with no external dependencies

Java ASCII Render ASCII renderer in pure java with no external dependencies. Java ASCII Render supports graphical primitives/elements, layers, context

David E. Veliev 140 Dec 12, 2022
Creates ASCII art in Java from Images

Creates ASCII art in Java from Images. It can also save the ASCII art as image (.png) as well

Navjot Singh Rakhra 4 Jul 12, 2022
ASCII Roguelike with Euro Strategy Board Game Influences

EuroRogue ASCII Roguelike with Euro Strategy Board Game Influences --Run the RunEuroRogue.bat file in the bin folder. Requires Java - https://www.java

null 4 Feb 1, 2022