C# Класс TextTools.TextTable

A class for rendering text based tables. This class needs just a printing function (like Console.WriteLine) and the maximum width of the table that has to be rendered. Therefore it is suitable for use in linux consoles with Mono
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Render ( IList data ) : void

The Render function which uses Console.Write for printing and Console.WindowWith to determine the with of the console.

Render ( IList data, OutputFunction outputFunction, int maximumWidth ) : void

The classic Render functions, which lets you supply the maximum width and the function which has to be used for printing.

TextTable ( IList
header ) : System

A constructor which requires an array of Header or a class with the IList

interaface implemeneted.

TextTable ( IList header ) : System

A constructor which requires an array of strings or a class with the IList interaface implemeneted. Internally the array will be converted in an array of Header with the default values used in TextTable.

Защищенные методы

Метод Описание
GetHeaderArrayOfStringArray ( IList header ) : TextTools.Header[]

A function for converting the string array into a header array, needed to fit in the constructor.

GetLongestDataEntryLength ( IList data, int row ) : int

Gets the longest data entry length in a data set of a specific row.

GetLongestDataEntryLengthArray ( IList data ) : int[]

Gets the longest data entry lengths of all rows.

Trim ( Align alignment, string text, int length ) : string

Trims the text according to length and alignment.

Описание методов

GetHeaderArrayOfStringArray() защищенный статический Метод

A function for converting the string array into a header array, needed to fit in the constructor.
protected static GetHeaderArrayOfStringArray ( IList header ) : TextTools.Header[]
header IList /// An array of strings ///
Результат TextTools.Header[]

GetLongestDataEntryLength() защищенный Метод

Gets the longest data entry length in a data set of a specific row.
protected GetLongestDataEntryLength ( IList data, int row ) : int
data IList /// A data object ///
row int /// The row to examine ///
Результат int

GetLongestDataEntryLengthArray() защищенный Метод

Gets the longest data entry lengths of all rows.
protected GetLongestDataEntryLengthArray ( IList data ) : int[]
data IList /// A data object ///
Результат int[]

Render() публичный Метод

The Render function which uses Console.Write for printing and Console.WindowWith to determine the with of the console.
public Render ( IList data ) : void
data IList /// A data object, the second dimension must fit the header length. ///
Результат void

Render() публичный Метод

The classic Render functions, which lets you supply the maximum width and the function which has to be used for printing.
public Render ( IList data, OutputFunction outputFunction, int maximumWidth ) : void
data IList /// A data object ///
outputFunction OutputFunction /// A delegate to the output function ///
maximumWidth int /// the maximum width of the table ///
Результат void

TextTable() публичный Метод

A constructor which requires an array of Header or a class with the IList
interaface implemeneted.
public TextTable ( IList
header ) : System
header IList
/// A header array ///
Результат System

TextTable() публичный Метод

A constructor which requires an array of strings or a class with the IList interaface implemeneted. Internally the array will be converted in an array of Header with the default values used in TextTable.
public TextTable ( IList header ) : System
header IList /// A string array ///
Результат System

Trim() защищенный Метод

Trims the text according to length and alignment.
protected Trim ( Align alignment, string text, int length ) : string
alignment Align /// Alignment value ///
text string /// Text to trim ///
length int /// The maximum length ///
Результат string