Class: Docxi::Word::Contents::Frame
- Inherits:
-
Object
- Object
- Docxi::Word::Contents::Frame
- Defined in:
- lib/docxi/word/contents/frame.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #br(options = {}) ⇒ Object
- #frame(options = {}, &block) ⇒ Object
- #image(image, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Frame
constructor
A new instance of Frame.
- #render(xml) ⇒ Object
- #tab(options = {}) ⇒ Object
- #text(text, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Frame
Returns a new instance of Frame.
8 9 10 11 12 13 14 15 16 |
# File 'lib/docxi/word/contents/frame.rb', line 8 def initialize(={}) @content = [] @options = if block_given? yield self else end end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
7 8 9 |
# File 'lib/docxi/word/contents/frame.rb', line 7 def content @content end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/docxi/word/contents/frame.rb', line 7 def @options end |
Instance Method Details
#br(options = {}) ⇒ Object
50 51 52 53 54 |
# File 'lib/docxi/word/contents/frame.rb', line 50 def br(={}) br = Docxi::Word::Contents::Break.new() @content << br br end |
#frame(options = {}, &block) ⇒ Object
62 63 64 65 66 |
# File 'lib/docxi/word/contents/frame.rb', line 62 def frame(={}, &block) element = Docxi::Word::Contents::Frame.new(, &block) @content << element element end |
#image(image, options = {}) ⇒ Object
75 76 77 78 79 |
# File 'lib/docxi/word/contents/frame.rb', line 75 def image(image, ={}) img = Docxi::Word::Contents::Image.new(image, ) @content << img img end |
#render(xml) ⇒ Object
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 44 45 46 47 48 |
# File 'lib/docxi/word/contents/frame.rb', line 18 def render(xml) xml['w'].r do xml['w'].pict do xml['v'].rect("fillcolor"=>"#bfbfbf[2412]", "strokecolor"=>"000000","strokeweight"=>"0pt", "style"=> @options[:style]) do xml['v'].fill("opacity" =>"52429f") xml['v'].textbox("inset" => "0in,0in,0in,0in") do xml['w'].txbxContent do xml['w'].p do xml['w'].pPr do xml['w'].pStyle('w:val'=>"Normal") xml['w'].pBdr do xml['w'].top('w:val'=>"nil") xml['w'].left('w:val'=>"nil") xml['w'].bottom('w:val'=>"nil") xml['w'].right('w:val'=>"nil") end if @options[:spacing] xml['w'].spacing('w:before'=>"240") end end @content.each do |element| element.render(xml) end end end end xml['w10'].wrap('type'=>"topAndBottom") end end end end |