blob: 69e59fe58c4707537b230da3d1c26cf8029b63b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
module Axlsx
# A simple, self serializing class for storing tables
class Tables < SimpleTypedList
# creates a new Tables object
def initialize(worksheet)
raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet)
super Table
@worksheet = worksheet
end
# The worksheet that owns this collection of tables
# @return [Worksheet]
attr_reader :worksheet
# returns the relationships required by this collection
def relationships
return [] if empty?
map { |table| Relationship.new(table, TABLE_R, "../#{table.pn}") }
end
# renders the tables xml
# @param [String] str
# @return [String]
def to_xml_string(str = "")
return if empty?
str << "<tableParts count='#{size}'>"
each { |table| str << "<tablePart r:id='#{table.rId}'/>" }
str << '</tableParts>'
end
end
end
|