lib/write_xlsx/drawing.rb in write_xlsx-1.08.2 vs lib/write_xlsx/drawing.rb in write_xlsx-1.09.0
- old
+ new
@@ -7,11 +7,11 @@
attr_accessor :type, :dimensions, :width, :height, :description, :shape, :anchor, :rel_index, :url_rel_index
attr_reader :tip, :decorative
def initialize(type, dimensions, width, height, description, shape, anchor, rel_index = nil, url_rel_index = nil, tip = nil, decorative = nil)
@type, @dimensions, @width, @height, @description, @shape, @anchor, @rel_index, @url_rel_index, @tip, @decorative =
- type, dimensions, width, height, description, shape, anchor, rel_index, url_rel_index, tip, decorative
+ type, dimensions, width, height, description, shape, anchor, rel_index, url_rel_index, tip, decorative
end
end
class Drawings
include Writexlsx::Utility
@@ -68,12 +68,12 @@
# Write the <xdr:wsDr> element.
#
def write_drawing_workspace
schema = 'http://schemas.openxmlformats.org/drawingml/'
attributes = [
- ['xmlns:xdr', "#{schema}2006/spreadsheetDrawing"],
- ['xmlns:a', "#{schema}2006/main"]
+ ['xmlns:xdr', "#{schema}2006/spreadsheetDrawing"],
+ ['xmlns:a', "#{schema}2006/main"]
]
@writer.tag_elements('xdr:wsDr', attributes) { yield }
end
@@ -164,11 +164,11 @@
# Write the xdr:clientData element.
write_client_data
end
end
- #
+ #
# Write the <xdr:from> element.
#
def write_from(col, row, col_offset, row_offset)
@writer.tag_elements('xdr:from') do
# Write the xdr:col element.
@@ -485,13 +485,13 @@
xmlns_c = "#{schema}drawingml/2006/chart"
xmlns_r = "#{schema}officeDocument/2006/relationships"
attributes = [
- ['xmlns:c', xmlns_c],
- ['xmlns:r', xmlns_r]
- ]
+ ['xmlns:c', xmlns_c],
+ ['xmlns:r', xmlns_r]
+ ]
attributes << r_id_attributes(id)
@writer.empty_tag('c:chart', attributes)
end
@@ -517,13 +517,13 @@
write_xdr_sp_pr(col_absolute, row_absolute, width, height, shape)
end
else
# Add attribute for shapes.
attributes = [
- [:macro, ''],
- [:textlink, '']
- ]
+ [:macro, ''],
+ [:textlink, '']
+ ]
@writer.tag_elements('xdr:sp', attributes) do
# Write the xdr:nvSpPr element.
write_nv_sp_pr(index, shape)
@@ -552,21 +552,21 @@
attributes = [ [:noChangeShapeType, '1'] ]
@writer.empty_tag('a:cxnSpLocks', attributes)
if shape.start
attributes = [
- ['id', shape.start],
- ['idx', shape.start_index]
- ]
+ ['id', shape.start],
+ ['idx', shape.start_index]
+ ]
@writer.empty_tag('a:stCxn', attributes)
end
if shape.end
attributes = [
- ['id', shape.end],
- ['idx', shape.end_index]
- ]
+ ['id', shape.end],
+ ['idx', shape.end_index]
+ ]
@writer.empty_tag('a:endCxn', attributes)
end
end
end
end
@@ -806,13 +806,13 @@
# Scale Adjustments: 100,000 = 100%.
adj_int = (adj * 1000).to_i
attributes = [
- [:name, "adj#{suffix}"],
- [:fmla, "val #{adj_int}"]
- ]
+ [:name, "adj#{suffix}"],
+ [:fmla, "val #{adj_int}"]
+ ]
@writer.empty_tag('a:gd', attributes)
end
end
else
@writer.empty_tag('a:avLst')
@@ -865,31 +865,31 @@
#
# Write the <xdr:txBody> element.
#
def write_tx_body(shape)
attributes = [
- [:vertOverflow, "clip"],
- [:wrap, "square"],
- [:lIns, "27432"],
- [:tIns, "22860"],
- [:rIns, "27432"],
- [:bIns, "22860"],
- [:anchor, shape.valign],
- [:upright, "1"]
- ]
+ [:vertOverflow, "clip"],
+ [:wrap, "square"],
+ [:lIns, "27432"],
+ [:tIns, "22860"],
+ [:rIns, "27432"],
+ [:bIns, "22860"],
+ [:anchor, shape.valign],
+ [:upright, "1"]
+ ]
@writer.tag_elements('xdr:txBody') do
@writer.empty_tag('a:bodyPr', attributes)
@writer.empty_tag('a:lstStyle')
@writer.tag_elements('a:p') do
rotation = shape.format[:rotation] || 0
rotation *= 60000
attributes = [
- [:algn, shape.align],
- [:rtl, rotation]
- ]
+ [:algn, shape.align],
+ [:rtl, rotation]
+ ]
@writer.tag_elements('a:pPr', attributes) do
attributes = [ [:sz, "1000"] ]
@writer.empty_tag('a:defRPr', attributes)
end
@@ -901,17 +901,17 @@
italic = shape.format[:italic] || 0
underline = ptrue?(shape.format[:underline]) ? 'sng' : 'none'
strike = ptrue?(shape.format[:font_strikeout]) ? 'Strike' : 'noStrike'
attributes = [
- [:lang, "en-US"],
- [:sz, size],
- [:b, bold],
- [:i, italic],
- [:u, underline],
- [:strike, strike],
- [:baseline, 0]
- ]
+ [:lang, "en-US"],
+ [:sz, size],
+ [:b, bold],
+ [:i, italic],
+ [:u, underline],
+ [:strike, strike],
+ [:baseline, 0]
+ ]
@writer.tag_elements('a:rPr', attributes) do
color = shape.format[:color]
if color
color = shape.palette_color(color)
color = color.sub(/^FF/, '') # Remove leading FF from rgb for shape color.