# Class: TableWriter

## helma.Html.TableWriter(numberOfColumns, attr)

This class provides various methods for programmatically creating an x/html table.

## Constructor

#### new TableWriter(numberOfColumns, attr)

Creates a new TableWriter instance

##### Parameters:

Name | Type | Description
--- | --- | ---
`numberOfColumns` | Number | The number of columns in the table
`attr` | Object | An object containing attributes to use when rendering the single table elements. For a description see #table.

Source:
  - helma/Html.js, line 835

##### Returns:

An instance of TableWriter

### Members

#### writeHeader :Boolean

If set to true the first row of the table data is rendered using `<th>` tags (defaults to false).

##### Type:

- Boolean

Source:
  - helma/Html.js, line 862

#### writeString :Boolean

If set to true the TableWriter returns the rendered table as string, otherwise the table is written directly to response, which is the default.

##### Type:

- Boolean

Source:
  - helma/Html.js, line 870

### Methods

#### close()

Closes all open table tags. If #writeString is set to true, this method returns the rendered table.

Source:
  - helma/Html.js, line 939

##### Returns:

The rendered table, if #writeString is set to true, otherwise void.

#### write(text, attr)

Writes a single table cell to response.

##### Parameters:

Name | Type | Description
--- | --- | ---
`text` | String | The content of the table cess
`attr` | Object | An optional object containig attributes to render for this table cell

Source:
  - helma/Html.js, line 888