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

Classes: Model, UserModel

Constant Summary collapse

VERSION =
"0.7.1.1"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.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 47

.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 75

.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 67

.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 57

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

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

Parameters:

  • bytes (String)

    binary icalc bytes

  • language_id (String)

Returns:

Raises:

  • (IronCalc::Error)


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

.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 31

.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

Instance Method Details

#add_sheet(name) ⇒ void

This method returns an undefined value.

Adds a new sheet with the given name.

Parameters:

  • name (String)

Raises:

  • (IronCalc::Error)


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

#clear_cell_contents(sheet, row, column) ⇒ void

This method returns an undefined value.

Clears a cell’s contents (not its style).

Parameters:

  • sheet (Integer)
  • row (Integer)
  • column (Integer)

Raises:

  • (IronCalc::Error)


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

#delete_columns(sheet, column, column_count) ⇒ void

This method returns an undefined value.

Deletes column_count columns starting at column.

Parameters:

  • sheet (Integer)
  • column (Integer)
  • column_count (Integer)

Raises:

  • (IronCalc::Error)


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

#delete_rows(sheet, row, row_count) ⇒ void

This method returns an undefined value.

Deletes row_count rows starting at row.

Parameters:

  • sheet (Integer)
  • row (Integer)
  • row_count (Integer)

Raises:

  • (IronCalc::Error)


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

#delete_sheet(sheet) ⇒ void

This method returns an undefined value.

Parameters:

  • sheet (Integer)

Raises:

  • (IronCalc::Error)


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

#evaluatevoid

This method returns an undefined value.

Recalculates the whole workbook. Call after #set_user_input.



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

#get_cell_content(sheet, row, column) ⇒ String

Returns the cell’s content: the formula (e.g. “=A1+1”) or literal text.

Parameters:

  • sheet (Integer)
  • row (Integer)
  • column (Integer)

Returns:

  • (String)

Raises:

  • (IronCalc::Error)


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

#get_cell_style_json(sheet, row, column) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

JSON backing for ‘get_cell_style`. Prefer the Hash-returning wrapper.

Returns:

  • (String)


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

#get_cell_type(sheet, row, column) ⇒ Symbol

Returns the cell type as a Symbol: :number, :text, :logical_value, :error_value, :array or :compound_data.

Parameters:

  • sheet (Integer)
  • row (Integer)
  • column (Integer)

Returns:

  • (Symbol)

Raises:

  • (IronCalc::Error)


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

#get_column_width(sheet, column) ⇒ Float

Returns width in pixels.

Parameters:

  • sheet (Integer)
  • column (Integer)

Returns:

  • (Float)

    width in pixels

Raises:

  • (IronCalc::Error)


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

#get_formatted_cell_value(sheet, row, column) ⇒ String

Returns the cell’s value formatted as displayed (number format applied).

Parameters:

  • sheet (Integer)
  • row (Integer)
  • column (Integer)

Returns:

  • (String)

Raises:

  • (IronCalc::Error)


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

#get_frozen_columns_count(sheet) ⇒ Integer

Parameters:

  • sheet (Integer)

Returns:

  • (Integer)

Raises:

  • (IronCalc::Error)


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

#get_frozen_rows_count(sheet) ⇒ Integer

Parameters:

  • sheet (Integer)

Returns:

  • (Integer)

Raises:

  • (IronCalc::Error)


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

#get_row_height(sheet, row) ⇒ Float

Returns height in pixels.

Parameters:

  • sheet (Integer)
  • row (Integer)

Returns:

  • (Float)

    height in pixels

Raises:

  • (IronCalc::Error)


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

#get_sheet_dimensions(sheet) ⇒ Array(Integer, Integer, Integer, Integer)

Returns [min_row, max_row, min_column, max_column] over non-empty cells (an empty sheet returns [1, 1, 1, 1]).

Parameters:

  • sheet (Integer)

Returns:

  • (Array(Integer, Integer, Integer, Integer))

Raises:

  • (IronCalc::Error)


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

#get_worksheets_propertiesArray<Hash>

Returns one Hash per sheet with symbol keys :name, :state, :sheet_id and :color.

Returns:

  • (Array<Hash>)


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

#insert_columns(sheet, column, column_count) ⇒ void

This method returns an undefined value.

Inserts column_count columns before column.

Parameters:

  • sheet (Integer)
  • column (Integer)
  • column_count (Integer)

Raises:

  • (IronCalc::Error)


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

#insert_rows(sheet, row, row_count) ⇒ void

This method returns an undefined value.

Inserts row_count rows before row.

Parameters:

  • sheet (Integer)
  • row (Integer)
  • row_count (Integer)

Raises:

  • (IronCalc::Error)


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

#new_sheetvoid

This method returns an undefined value.

Adds a new sheet with an auto-generated name.



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

#rename_sheet(sheet, new_name) ⇒ void

This method returns an undefined value.

Parameters:

  • sheet (Integer)
  • new_name (String)

Raises:

  • (IronCalc::Error)


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

#save_to_icalc(file) ⇒ void

This method returns an undefined value.

Saves the workbook to the internal binary icalc format.

Parameters:

  • file (String)

Raises:

  • (IronCalc::Error)


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

#save_to_xlsx(file) ⇒ void

This method returns an undefined value.

Saves the workbook to an xlsx file. Fails if the file already exists.

Parameters:

  • file (String)

Raises:

  • (IronCalc::Error)


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

#set_cell_style_json(sheet, row, column, style_json) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

JSON backing for ‘set_cell_style`. Prefer the Hash-accepting wrapper.



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

#set_column_width(sheet, column, width) ⇒ void

This method returns an undefined value.

Parameters:

  • sheet (Integer)
  • column (Integer)
  • width (Float)

Raises:

  • (IronCalc::Error)


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

#set_frozen_columns_count(sheet, count) ⇒ void

This method returns an undefined value.

Parameters:

  • sheet (Integer)
  • count (Integer)

Raises:

  • (IronCalc::Error)


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

#set_frozen_rows_count(sheet, count) ⇒ void

This method returns an undefined value.

Parameters:

  • sheet (Integer)
  • count (Integer)

Raises:

  • (IronCalc::Error)


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

#set_row_height(sheet, row, height) ⇒ void

This method returns an undefined value.

Parameters:

  • sheet (Integer)
  • row (Integer)
  • height (Float)

Raises:

  • (IronCalc::Error)


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

#set_sheet_color(sheet, color) ⇒ void

This method returns an undefined value.

Parameters:

  • sheet (Integer)
  • color (String)

    hex color, e.g. “#FF0000”

Raises:

  • (IronCalc::Error)


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

#set_user_input(sheet, row, column, value) ⇒ void

This method returns an undefined value.

Sets a cell’s raw input (a literal or a formula like “=A1+1”).

Parameters:

  • sheet (Integer)
  • row (Integer)
  • column (Integer)
  • value (String)

Raises:

  • (IronCalc::Error)


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

#to_bytesString

Serializes the workbook to icalc bytes (load with load_from_bytes).

Returns:

  • (String)

    binary string



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