Permalink
Browse files

add comment relationship type

  • Loading branch information...
1 parent 50c3658 commit f6a2ddc9e84e37d02aefc7f69bb2e3c72698d165 @randym randym committed May 4, 2012
Showing with 5 additions and 1 deletion.
  1. +3 −0 lib/axlsx/util/constants.rb
  2. +1 −1 lib/axlsx/util/validators.rb
  3. +1 −0 test/rels/tc_relationship.rb
View
3 lib/axlsx/util/constants.rb
@@ -79,6 +79,9 @@ module Axlsx
# image rels namespace
HYPERLINK_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"
+ # comment rels namespace
+ COMMENT_R = "http://purl.oclc.org/ooxml/officeDocument/relationships/comments"
+
# table content type
TABLE_CT = "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"
View
2 lib/axlsx/util/validators.rb
@@ -179,7 +179,7 @@ def self.validate_content_type(v)
# XML_NS_R, TABLE_R, WORKBOOK_R, WORKSHEET_R, APP_R, RELS_R, CORE_R, STYLES_R, CHART_R, DRAWING_R, IMAGE_R, HYPERLINK_R, SHARED_STRINGS_R are allowed
# @param [Any] v The value validated
def self.validate_relationship_type(v)
- RestrictionValidator.validate :relationship_type, [XML_NS_R, TABLE_R, WORKBOOK_R, WORKSHEET_R, APP_R, RELS_R, CORE_R, STYLES_R, CHART_R, DRAWING_R, IMAGE_R, HYPERLINK_R, SHARED_STRINGS_R], v
+ RestrictionValidator.validate :relationship_type, [XML_NS_R, TABLE_R, WORKBOOK_R, WORKSHEET_R, APP_R, RELS_R, CORE_R, STYLES_R, CHART_R, DRAWING_R, IMAGE_R, HYPERLINK_R, SHARED_STRINGS_R, COMMENT_R], v
end
# Requires that the value is a valid table element type
View
1 test/rels/tc_relationship.rb
@@ -10,6 +10,7 @@ def teardown
def test_type
assert_raise(ArgumentError) { Axlsx::Relationship.new 'type', 'target' }
assert_nothing_raised { Axlsx::Relationship.new Axlsx::WORKSHEET_R, 'target' }
+ assert_nothing_raised { Axlsx::Relationship.new Axlsx::COMMENT_R, 'target' }
end
def test_target_mode

0 comments on commit f6a2ddc

Please sign in to comment.