# `Kreuzberg.Table`
[🔗](https://github.com/kreuzberg-dev/kreuzberg/blob/main/lib/kreuzberg/table.ex#L1)

Structure representing an extracted table from a document.

Matches the Rust `Table` struct with cells, markdown, page number, and optional bounding box.

## Fields

  * `:cells` - Two-dimensional list of table cells [[cell1, cell2], ...]
  * `:markdown` - Markdown representation of the table
  * `:page_number` - Page number where table appears (0-indexed)
  * `:bounding_box` - Bounding box coordinates {x0, y0, x1, y1} if available, nil otherwise

## Examples

    iex> table = %Kreuzberg.Table{
    ...>   cells: [["Name", "Age"], ["Alice", "30"]],
    ...>   markdown: "| Name | Age |\n|------|-----|\n| Alice | 30 |",
    ...>   page_number: 0
    ...> }
    iex> table.cells
    [["Name", "Age"], ["Alice", "30"]]

# `t`

```elixir
@type t() :: %Kreuzberg.Table{
  bounding_box: map() | nil,
  cells: [[String.t()]],
  markdown: String.t(),
  page_number: non_neg_integer()
}
```

# `column_count`

```elixir
@spec column_count(t()) :: non_neg_integer()
```

Returns the number of columns in the table.

## Examples

    iex> table = %Kreuzberg.Table{cells: [["A", "B"], ["1", "2"]]}
    iex> Kreuzberg.Table.column_count(table)
    2

# `from_map`

```elixir
@spec from_map(map()) :: t()
```

Creates a Table struct from a map.

## Examples

    iex> Kreuzberg.Table.from_map(%{"cells" => [["A", "B"]], "markdown" => "| A | B |", "page_number" => 0})
    %Kreuzberg.Table{cells: [["A", "B"]], markdown: "| A | B |", page_number: 0}

# `row_count`

```elixir
@spec row_count(t()) :: non_neg_integer()
```

Returns the number of rows in the table.

## Examples

    iex> table = %Kreuzberg.Table{cells: [["A", "B"], ["1", "2"]]}
    iex> Kreuzberg.Table.row_count(table)
    2

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Converts a Table struct to a map.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
