class Axlsx::Tables

A simple, self serializing class for storing tables

Attributes

worksheet[R]

The worksheet that owns this collection of tables @return [Worksheet]

Public Class Methods

new(worksheet) click to toggle source

creates a new Tables object

Calls superclass method Axlsx::SimpleTypedList::new
# File lib/axlsx/workbook/worksheet/tables.rb, line 7
def initialize(worksheet)
  raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet)
  super Table
  @worksheet = worksheet
end

Public Instance Methods

relationships() click to toggle source

returns the relationships required by this collection

# File lib/axlsx/workbook/worksheet/tables.rb, line 18
def relationships
  return [] if empty?
  map{ |table| Relationship.new(table, TABLE_R, "../#{table.pn}") }
end
to_xml_string(str = "") click to toggle source
# File lib/axlsx/workbook/worksheet/tables.rb, line 23
def to_xml_string(str = "")
  return if empty?
  str << "<tableParts count='#{size}'>"
  each { |table| str << "<tablePart r:id='#{table.rId}'/>" }
  str << '</tableParts>'
end