1Text::FormatTable(3)  User Contributed Perl Documentation Text::FormatTable(3)
2
3
4

NAME

6       Text::FormatTable - Format text tables
7

SYNOPSIS

9        my $table = Text::FormatTable->new('r|l');
10        $table->head('a', 'b');
11        $table->rule('=');
12        $table->row('c', 'd');
13        print $table->render(20);
14

DESCRIPTION

16       Text::FormatTable renders simple tables as text. You pass to the
17       constructor (new) a table format specification similar to LaTeX (e.g.
18       "r|l|5l|R|20L") and you call methods to fill the table data and insert
19       rules. After the data is filled, you call the render method and the
20       table gets formatted as text.
21
22       Methods:
23
24       new($format)
25           Create a Text::FormatTable object, the format of each column is
26           specified as a character of the $format string. The following
27           formats are defined:
28
29           l   Left-justified top aligned word-wrapped text.
30
31           L   Left-justified bottom aligned word-wrapped text.
32
33           r   Right-justified top aligned word-wrapped text.
34
35           R   Right-justified bottom aligned word-wrapped text.
36
37           10R, 20r, 15L, 12l,
38               Number is fixed width of the column.  Justified and aligned
39               word-wrapped text (see above).
40
41           ' ' A space.
42
43           |   Column separator.
44
45       head($col1, $col2, ...)
46           Add a header row using $col1, $col2, etc. as cell contents. Note
47           that, at the moment, header rows are treated like normal rows.
48
49       row($col1, $col2, ...)
50           Add a row with $col1, $col2, etc. as cell contents.
51
52       rule([$char])
53           Add an horizontal rule. If $char is specified it will be used as
54           character to draw the rule, otherwise '-' will be used.
55
56       render([$screen_width])
57           Return the rendered table formatted with $screen_width or 79 if it
58           is not specified.
59

SEE ALSO

61       Text::ASCIITable
62
64       Copyright (c) 2001-2004 Swiss Federal Institute of Technology, Zurich.
65                 (c) 2009 Trey Harris All Rights Reserved.
66
67       This module is free software; you can redistribute it and/or modify it
68       under the same terms as Perl itself.
69

CODE REPOSITORY

71       Git - http://github.com/treyharris/Text-FormatTable/tree/master
72

AUTHOR

74       David Schweikert <dws@ee.ethz.ch>
75
76       Maintained by Trey Harris <treyharris@gmail.com>
77
78       Fixed column width and bottom alignment written by
79       Veselin Slavov <vslavov@creditreform.bg>
80
81
82
83perl v5.30.1                      2020-01-30              Text::FormatTable(3)
Impressum