lib/caracal/renderers/document_renderer.rb in caracal-1.0.4 vs lib/caracal/renderers/document_renderer.rb in caracal-1.0.5
- old
+ new
@@ -73,17 +73,18 @@
if paragraph_level && attrs.empty?
# skip
else
xml.send 'w:rPr' do
unless attrs.empty?
- xml.send 'w:rStyle', { 'w:val' => attrs[:style] } unless attrs[:style].nil?
- xml.send 'w:color', { 'w:val' => attrs[:color] } unless attrs[:color].nil?
- xml.send 'w:sz', { 'w:val' => attrs[:size] } unless attrs[:size].nil?
- xml.send 'w:b', { 'w:val' => (attrs[:bold] ? '1' : '0') } unless attrs[:bold].nil?
- xml.send 'w:i', { 'w:val' => (attrs[:italic] ? '1' : '0') } unless attrs[:italic].nil?
- xml.send 'w:u', { 'w:val' => (attrs[:underline] ? 'single' : 'none') } unless attrs[:underline].nil?
- xml.send 'w:shd', { 'w:fill' => attrs[:bgcolor], 'w:val' => 'clear' } unless attrs[:bgcolor].nil?
+ xml.send 'w:rStyle', { 'w:val' => attrs[:style] } unless attrs[:style].nil?
+ xml.send 'w:color', { 'w:val' => attrs[:color] } unless attrs[:color].nil?
+ xml.send 'w:sz', { 'w:val' => attrs[:size] } unless attrs[:size].nil?
+ xml.send 'w:b', { 'w:val' => (attrs[:bold] ? '1' : '0') } unless attrs[:bold].nil?
+ xml.send 'w:i', { 'w:val' => (attrs[:italic] ? '1' : '0') } unless attrs[:italic].nil?
+ xml.send 'w:u', { 'w:val' => (attrs[:underline] ? 'single' : 'none') } unless attrs[:underline].nil?
+ xml.send 'w:shd', { 'w:fill' => attrs[:bgcolor], 'w:val' => 'clear' } unless attrs[:bgcolor].nil?
+ xml.send 'w:vertAlign', { 'w:val' => attrs[:vertical_align] } unless attrs[:vertical_align].nil?
unless attrs[:font].nil?
f = attrs[:font]
xml.send 'w:rFonts', { 'w:ascii' => f, 'w:hAnsi' => f, 'w:eastAsia' => f, 'w:cs' => f }
end
end
@@ -298,9 +299,10 @@
xml.send 'w:tr' do
row.each do |tc|
xml.send 'w:tc' do
xml.send 'tcPr' do
xml.send 'w:shd', { 'w:fill' => tc.cell_background }
+ xml.send 'w:vAlign', { 'w:val' => tc.cell_vertical_align }
xml.send 'w:tcMar' do
%w(top left bottom right).each do |d|
xml.send "w:#{ d }", { 'w:w' => tc.send("cell_margin_#{ d }").to_f, 'w:type' => 'dxa' }
end
end