blob: 57b9afc0019501969e1363ebe04b0782490fe106 (
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
32
33
34
35
36
37
38
39
40
41
42
43
|
module Axlsx
# A relationship defines a reference between package parts.
# @note Packages automatcially manage relationships.
class Relationship
# The location of the relationship target
# @return [String]
attr_accessor :Target
# The type of relationship
# @note Supported types are defined as constants in Axlsx:
# @see XML_NS_R
# @see TABLE_R
# @see WORKBOOK_R
# @see WORKSHEET_R
# @see APP_R
# @see RELS_R
# @see CORE_R
# @see STYLES_R
# @see CHART_R
# @see DRAWING_R
# @return [String]
attr_accessor :Type
def initialize(type, target)
self.Target=target
self.Type=type
end
def Target=(v) Axlsx::validate_string v; @Target = v end
def Type=(v) Axlsx::validate_relationship_type v; @Type = v end
# Serializes the relationship
# TODO: use object.rId to get this infomation
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
# @param [String] rId the reference id of the object.
# @return [String]
def to_xml(xml, rId)
h = self.instance_values
h[:Id] = rId
xml.Relationship(h)
end
end
end
|