Method: Axlsx::SharedStringsTable#initialize

Defined in:
lib/axlsx/workbook/shared_strings_table.rb

#initialize(cells, xml_space = :preserve) ⇒ SharedStringsTable

Creates a new Shared Strings Table against an array of cells

Parameters:

  • cells (Array)

    This is an array of all of the cells in the workbook

  • xml_space (Symbol) (defaults to: :preserve)

    The xml:space behavior for the shared string table.



35
36
37
38
39
40
41
42
43
# File 'lib/axlsx/workbook/shared_strings_table.rb', line 35

def initialize(cells, xml_space = :preserve)
  @index = 0
  @xml_space = xml_space
  @unique_cells = {}
  @shared_xml_string = +''
  shareable_cells = cells.flatten.select { |cell| cell.plain_string? || cell.contains_rich_text? }
  @count = shareable_cells.size
  resolve(shareable_cells)
end