Module: IronCalc

Defined in:
lib/ironcalc/model.rb,
lib/ironcalc/version.rb,
lib/ironcalc/native_methods.rb

Overview

Documentation-only stubs for the methods implemented in the native extension (ext/ironcalc, via magnus). YARD cannot see Rust source, so the public native API is described here with @!method directives. This file is NOT required at runtime — the real methods are defined by the compiled extension. Keep these stubs in sync with the Rust sources in ext/ironcalc/src (and rake parity).

Coordinate convention everywhere: sheet is a 0-based index; row and column are 1-based.

Defined Under Namespace

Modules: Batch, DefinedNames Classes: Model, UserModel

Constant Summary collapse

VERSION =
"0.9.0.0"

Class Method Summary collapse

Class Method Details

.column_to_number(column) ⇒ Integer

Column identifier to 1-based number: "AA" becomes 27.

Parameters:

  • column (String) —

    uppercase A-Z letters

Returns:

  • (Integer)

Raises:

  • (IronCalc::Error) —

    if it is not a valid column identifier



# File 'lib/ironcalc/native_methods.rb', line 106

.create(name, locale, tz, language_id) ⇒ IronCalc::Model

Creates an empty workbook using the raw Model API.

Parameters:

  • name (String) —

    workbook name

  • locale (String) —

    e.g. "en"

  • tz (String) —

    IANA timezone, e.g. "UTC"

  • language_id (String) —

    e.g. "en"

Returns:

Raises:

  • (IronCalc::Error)


# File 'lib/ironcalc/native_methods.rb', line 11

.create_user_model(name, locale, tz, language_id) ⇒ IronCalc::UserModel

Creates an empty workbook using the recommended UserModel API.

Parameters:

  • name (String)
  • locale (String)
  • tz (String)
  • language_id (String)

Returns:

Raises:

  • (IronCalc::Error)


# File 'lib/ironcalc/native_methods.rb', line 59

.create_user_model_from_bytes(bytes, language_id) ⇒ IronCalc::UserModel

Loads icalc bytes into the UserModel API.

Parameters:

  • bytes (String) —

    binary icalc bytes

  • language_id (String)

Returns:

Raises:

  • (IronCalc::Error)


# File 'lib/ironcalc/native_methods.rb', line 98

.create_user_model_from_icalc(file_name, language_id) ⇒ IronCalc::UserModel

Loads an icalc file into the UserModel API.

Parameters:

  • file_name (String)
  • language_id (String)

Returns:

Raises:

  • (IronCalc::Error)


# File 'lib/ironcalc/native_methods.rb', line 90

.create_user_model_from_xlsx(file_path, locale, tz, language_id) ⇒ IronCalc::UserModel

Loads an xlsx file into the UserModel API.

Parameters:

  • file_path (String)
  • locale (String)
  • tz (String)
  • language_id (String)

Returns:

Raises:

  • (IronCalc::Error)


# File 'lib/ironcalc/native_methods.rb', line 69

.create_user_model_from_xlsx_bytes(bytes, name, locale, tz, language_id) ⇒ IronCalc::UserModel

Loads the bytes of an xlsx file into the UserModel API.

Parameters:

  • bytes (String) —

    binary xlsx bytes

  • name (String) —

    workbook name

  • locale (String)
  • tz (String)
  • language_id (String)

Returns:

Raises:

  • (IronCalc::Error)


# File 'lib/ironcalc/native_methods.rb', line 79

.get_all_timezones ⇒ Array<String>

Timezone names accepted by the constructors.

Returns:

  • (Array<String>)


# File 'lib/ironcalc/native_methods.rb', line 188

.get_supported_locales ⇒ Array<String>

Locale identifiers accepted by the constructors.

Returns:

  • (Array<String>)


# File 'lib/ironcalc/native_methods.rb', line 183

.is_valid_a1_identifier(name) ⇒ Boolean

Whether name can be a name in an A1-style formula. Anything that reads as a cell reference is not one.

IronCalc.is_valid_a1_identifier("total")  # => true
IronCalc.is_valid_a1_identifier("R")      # => true
IronCalc.is_valid_a1_identifier("A1")     # => false, a cell reference

Parameters:

  • name (String)

Returns:

  • (Boolean)


# File 'lib/ironcalc/native_methods.rb', line 151

.is_valid_column(column) ⇒ Boolean

Whether column is a column identifier within the sheet, e.g. "AA".

Parameters:

  • column (String)

Returns:

  • (Boolean)


# File 'lib/ironcalc/native_methods.rb', line 119

.is_valid_column_number(column) ⇒ Boolean

Whether column is a 1-based column number within the sheet.

Parameters:

  • column (Integer)

Returns:

  • (Boolean)


# File 'lib/ironcalc/native_methods.rb', line 125

.is_valid_identifier(name) ⇒ Boolean

Whether name can be a defined name. This is is_valid_a1_identifier minus the four single letters "R", "r", "C" and "c", which spreadsheets reserve for R1C1 notation — they stay usable as LAMBDA parameters and LET variables, so the A1 form accepts them.

IronCalc.is_valid_identifier("total")  # => true
IronCalc.is_valid_identifier("R")      # => false, the only difference
IronCalc.is_valid_identifier("A1")     # => false, a cell reference

Parameters:

  • name (String)

Returns:

  • (Boolean)


# File 'lib/ironcalc/native_methods.rb', line 137

.is_valid_row(row) ⇒ Boolean

Whether row is a 1-based row number within the sheet.

Parameters:

  • row (Integer)

Returns:

  • (Boolean)


# File 'lib/ironcalc/native_methods.rb', line 131

.load_from_bytes(bytes, language_id) ⇒ IronCalc::Model

Loads a workbook from icalc bytes (as produced by IronCalc::Model#to_bytes).

Parameters:

  • bytes (String) —

    binary icalc bytes

  • language_id (String)

Returns:

Raises:

  • (IronCalc::Error)


# File 'lib/ironcalc/native_methods.rb', line 51

.load_from_icalc(file_name, language_id) ⇒ IronCalc::Model

Loads a workbook from the internal binary icalc format.

Parameters:

  • file_name (String)
  • language_id (String)

Returns:

Raises:

  • (IronCalc::Error)


# File 'lib/ironcalc/native_methods.rb', line 43

.load_from_xlsx(file_path, locale, tz, language_id) ⇒ IronCalc::Model

Loads a workbook from an xlsx file into the raw Model API.

Parameters:

  • file_path (String)
  • locale (String)
  • tz (String)
  • language_id (String)

Returns:

Raises:

  • (IronCalc::Error)


# File 'lib/ironcalc/native_methods.rb', line 21

.load_from_xlsx_bytes(bytes, name, locale, tz, language_id) ⇒ IronCalc::Model

Loads a workbook from the bytes of an xlsx file into the raw Model API (as produced by IronCalc::Model#to_xlsx_bytes).

Parameters:

  • bytes (String) —

    binary xlsx bytes

  • name (String) —

    workbook name

  • locale (String)
  • tz (String)
  • language_id (String)

Returns:

Raises:

  • (IronCalc::Error)


# File 'lib/ironcalc/native_methods.rb', line 31

.number_to_column(column) ⇒ String?

1-based number to column identifier: 27 becomes "AA".

Parameters:

  • column (Integer)

Returns:

  • (String, nil) —

    nil when outside the sheet's columns



# File 'lib/ironcalc/native_methods.rb', line 113

.parse_reference_a1(reference) ⇒ Hash?

Parses A1 notation into { row:, column:, absolute_row:, absolute_column: }, with 1-based coordinates. "$B$2" reports both absolute flags.

Parameters:

  • reference (String)

Returns:

  • (Hash, nil) —

    nil if it does not parse



# File 'lib/ironcalc/native_methods.rb', line 170

.parse_reference_r1c1(reference) ⇒ Hash?

As parse_reference_a1, for R1C1 notation such as "R2C3".

Parameters:

  • reference (String)

Returns:

  • (Hash, nil) —

    nil if it does not parse



# File 'lib/ironcalc/native_methods.rb', line 177

.quote_name(name) ⇒ String

Quotes a sheet name if a formula reference would need it: "My Sheet" becomes "'My Sheet'", "Sheet1" is returned unchanged.

Parameters:

  • name (String)

Returns:

  • (String)


# File 'lib/ironcalc/native_methods.rb', line 163