elixlsx v0.3.1 Elixlsx.Sheet

Describes a single sheet with a given name. The name can be up to 31 characters long. The rows property is a list, each corresponding to a row (from the top), of lists, each corresponding to a column (from the left), of contents.

Content may be

  • a String.t (unicode),
  • a number, or
  • a list [String|number, property_list…]

The property list describes formatting options for that cell. See Font.from_props/1 for a list of options.

Summary

Functions

Removes any pane freezing that has been set

Set a cell at a given row/column index. Indizes start at 0

Set a cell indexed by excel coordinates

Set the column width for a given column. Column is indexed by name (“A”, …)

Set the pane freeze at the given row and column. Row and column are indexed starting from 1. Special value 0 means no freezing, e.g. {1, 0} will freeze first row and no columns

Set the row height for a given row. Row is indexed starting from 1

Returns a “CSV” representation of the Sheet. This is mainly used for doctests and does not generate valid CSV (yet)

Create a sheet with a sheet name. The name can be up to 31 characters long

Types

t()
t :: %Elixlsx.Sheet{col_widths: %{optional(pos_integer) => number}, merge_cells: [], name: String.t, pane_freeze: {number, number} | nil, row_heights: %{optional(pos_integer) => number}, rows: [[any]], show_grid_lines: boolean}

Functions

remove_pane_freeze(sheet)
remove_pane_freeze(Elixlsx.Sheet.t) :: Elixlsx.Sheet.t

Removes any pane freezing that has been set

set_at(sheet, rowidx, colidx, content, opts \\ [])
set_at(Elixlsx.Sheet.t, non_neg_integer, non_neg_integer, any, [{:key, any}]) :: Elixlsx.Sheet.t

Set a cell at a given row/column index. Indizes start at 0.

Example

iex> %Elixlsx.Sheet{} |>
...> Elixlsx.Sheet.set_at(0, 2, "Hello World",
...>                bold: true, underline: true) |>
...> Elixlsx.Sheet.to_csv_string
",,Hello World"
set_cell(sheet, index, content, opts \\ [])
set_cell(Elixlsx.Sheet.t, String.t, any, [{:key, any}]) :: Elixlsx.Sheet.t

Set a cell indexed by excel coordinates.

Example

iex> %Elixlsx.Sheet{} |>
...> Elixlsx.Sheet.set_cell("C1", "Hello World",
...>                bold: true, underline: true) |>
...> Elixlsx.Sheet.to_csv_string
",,Hello World"
set_col_width(sheet, column, width)
set_col_width(Elixlsx.Sheet.t, String.t, number) :: Elixlsx.Sheet.t

Set the column width for a given column. Column is indexed by name (“A”, …)

set_pane_freeze(sheet, row_idx, col_idx)
set_pane_freeze(Elixlsx.Sheet.t, number, number) :: Elixlsx.Sheet.t

Set the pane freeze at the given row and column. Row and column are indexed starting from 1. Special value 0 means no freezing, e.g. {1, 0} will freeze first row and no columns.

set_row_height(sheet, row_idx, height)
set_row_height(Elixlsx.Sheet.t, number, number) :: Elixlsx.Sheet.t

Set the row height for a given row. Row is indexed starting from 1

to_csv_string(sheet)

Returns a “CSV” representation of the Sheet. This is mainly used for doctests and does not generate valid CSV (yet).

with_name(name)
with_name(String.t) :: Elixlsx.Sheet.t

Create a sheet with a sheet name. The name can be up to 31 characters long.