Class: Axlsx::RichText
- Inherits:
-
SimpleTypedList
- Object
- SimpleTypedList
- Axlsx::RichText
- Defined in:
- lib/axlsx/workbook/worksheet/rich_text.rb
Instance Attribute Summary collapse
-
#cell ⇒ Object
Returns the value of attribute cell.
Instance Method Summary collapse
- #add_run(text, options = {}) ⇒ Object
- #autowidth ⇒ Object
-
#initialize(text = nil, options = {}) {|_self| ... } ⇒ RichText
constructor
A new instance of RichText.
- #runs ⇒ Object
- #to_xml_string(str = '') ⇒ Object
Constructor Details
#initialize(text = nil, options = {}) {|_self| ... } ⇒ RichText
Returns a new instance of RichText.
3 4 5 6 7 |
# File 'lib/axlsx/workbook/worksheet/rich_text.rb', line 3 def initialize(text = nil, ={}) super(RichTextRun) add_run(text, ) unless text.nil? yield self if block_given? end |
Instance Attribute Details
#cell ⇒ Object
Returns the value of attribute cell.
9 10 11 |
# File 'lib/axlsx/workbook/worksheet/rich_text.rb', line 9 def cell @cell end |
Instance Method Details
#add_run(text, options = {}) ⇒ Object
22 23 24 |
# File 'lib/axlsx/workbook/worksheet/rich_text.rb', line 22 def add_run(text, ={}) self << RichTextRun.new(text, ) end |
#autowidth ⇒ Object
16 17 18 19 20 |
# File 'lib/axlsx/workbook/worksheet/rich_text.rb', line 16 def autowidth widtharray = [0] # Are arrays the best way of solving this problem? each { |run| run.autowidth(widtharray) } widtharray.max end |
#runs ⇒ Object
26 27 28 |
# File 'lib/axlsx/workbook/worksheet/rich_text.rb', line 26 def runs self end |
#to_xml_string(str = '') ⇒ Object
30 31 32 33 |
# File 'lib/axlsx/workbook/worksheet/rich_text.rb', line 30 def to_xml_string(str='') each{ |run| run.to_xml_string(str) } str end |