diff options
| author | Randy Morgan <[email protected]> | 2012-08-12 23:42:31 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-08-12 23:42:31 +0900 |
| commit | fd451cdb2dd1f6305d199054501dd84f716d15ce (patch) | |
| tree | d03b2a68a04dd654cf2a516db4c346aa1b26c8f1 /lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb | |
| parent | 874fab4140637f3df989c3606364c8dfa1502a6e (diff) | |
| download | caxlsx-fd451cdb2dd1f6305d199054501dd84f716d15ce.tar.gz caxlsx-fd451cdb2dd1f6305d199054501dd84f716d15ce.zip | |
Release prep
Diffstat (limited to 'lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb b/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb index 64c1949d..5de0a6d2 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb @@ -36,7 +36,7 @@ module Axlsx end # Sets the cell location of this hyperlink in the worksheet - # @param [String|Cell] The string reference or cell that defines where this hyperlink shows in the worksheet. + # @param [String|Cell] cell_reference The string reference or cell that defines where this hyperlink shows in the worksheet. def ref=(cell_reference) cell_reference = cell_reference.r if cell_reference.is_a?(Cell) @@ -61,21 +61,33 @@ module Axlsx } end + # The relationship required by this hyperlink when the taget is :external + # @return [Relationship] def relationship return unless @target == :external Relationship.new HYPERLINK_R, location, :target_mode => :External end + # The id of the relationship for this object + # @return [String] def id + return unless @target == :external "rId#{(@worksheet.relationships_index_of(self)+1)}" end + # Seralize the object + # @param [String] str + # @return [String] def to_xml_string(str='') str << '<hyperlink ' serialization_values.map { |key, value| str << key.to_s << '="' << value.to_s << '" ' } str << '/>' end + # The values to be used in serialization based on the target. + # location should only be specified for non-external targets. + # r:id should only be specified for external targets. + # @return [Hash] def serialization_values h = instance_values.reject { |key, value| !%w(display ref tooltip).include?(key) } if @target == :external |
