XlsxReader.Styles (xlsx_reader v0.8.12)

Copy Markdown View Source

Utility functions and types to deal with cell styles

Summary

Types

Matches the text representation of a cell value

Knwon cell styles for which type conversion is supported

Cell styles for which type conversion is supported

Types

custom_format_matcher()

@type custom_format_matcher() :: String.t() | Regex.t()

Matches the text representation of a cell value

custom_formats()

@type custom_formats() :: %{optional(String.t()) => String.t()}

known_style_type()

@type known_style_type() ::
  :string | :number | :percentage | :date | :time | :date_time | :unsupported

Knwon cell styles for which type conversion is supported

style_type()

@type style_type() :: known_style_type() | String.t()

Cell styles for which type conversion is supported

style_types()

@type style_types() :: XlsxReader.Array.t(style_type())

supported_custom_formats()

@type supported_custom_formats() :: [{custom_format_matcher(), known_style_type()}]

Functions

get_style_type(num_fmt_id, custom_formats \\ %{}, supported_custom_formats \\ [])

@spec get_style_type(String.t(), custom_formats(), supported_custom_formats()) ::
  style_type() | nil

Guesses the type of a cell based on its style.

The type is:

  1. looked-up from a list of "standard" styles, or
  2. guessed from a list of default supported custom formats, or
  3. guessed from a list of user-provided supported custom formats.

If no type could be guessed, returns nil.