diff options
| author | Randy Morgan <[email protected]> | 2012-05-15 11:23:59 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-05-15 11:23:59 +0900 |
| commit | 2d744ba77906d460b608859c945a5741ec725e42 (patch) | |
| tree | 0366b619ea15909d230a2fa485a95d395486d6cf /lib | |
| parent | 2e1e14dd8f91e8a1416faae9501fdf04638104c7 (diff) | |
| download | caxlsx-2d744ba77906d460b608859c945a5741ec725e42.tar.gz caxlsx-2d744ba77906d460b608859c945a5741ec725e42.zip | |
bring coverage up to 100% and patch a few minor bugs in cell style overrides and misnamed app attributes.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/doc_props/app.rb | 4 | ||||
| -rw-r--r-- | lib/axlsx/drawing/axis.rb | 2 | ||||
| -rw-r--r-- | lib/axlsx/drawing/vml_shape.rb | 3 | ||||
| -rw-r--r-- | lib/axlsx/util/simple_typed_list.rb | 13 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/cell.rb | 5 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/comment.rb | 6 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/worksheet.rb | 4 |
7 files changed, 9 insertions, 28 deletions
diff --git a/lib/axlsx/doc_props/app.rb b/lib/axlsx/doc_props/app.rb index 1b5fc2ad..9f8b318b 100644 --- a/lib/axlsx/doc_props/app.rb +++ b/lib/axlsx/doc_props/app.rb @@ -62,10 +62,10 @@ module Axlsx attr_reader :CharactersWithSpaces # @return [Boolean] Indicates if the document is shared. - attr_reader :ShareDoc + attr_reader :SharedDoc # @return [String] The base for hyper links in the document. - attr_reader :HyperLinkBase + attr_reader :HyperlinkBase # @return [Boolean] Indicates that the hyper links in the document have been changed. attr_reader :HyperlinksChanged diff --git a/lib/axlsx/drawing/axis.rb b/lib/axlsx/drawing/axis.rb index 1e16dee6..1cc23448 100644 --- a/lib/axlsx/drawing/axis.rb +++ b/lib/axlsx/drawing/axis.rb @@ -116,7 +116,7 @@ module Axlsx str << '<c:delete val="'<< @delete.to_s << '"/>' str << '<c:axPos val="' << @axPos.to_s << '"/>' str << '<c:majorGridlines>' - if self.gridlines == false + if gridlines == false str << '<c:spPr>' str << '<a:ln>' str << '<a:noFill/>' diff --git a/lib/axlsx/drawing/vml_shape.rb b/lib/axlsx/drawing/vml_shape.rb index d1aaf07e..c4b56237 100644 --- a/lib/axlsx/drawing/vml_shape.rb +++ b/lib/axlsx/drawing/vml_shape.rb @@ -58,6 +58,7 @@ module Axlsx @top_offset = 2 @right_offset = 50 @bottom_offset = 5 + @id = (0...8).map{65.+(rand(25)).chr}.join options.each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end @@ -99,7 +100,7 @@ module Axlsx def to_xml_string(str ='') str << <<SHAME_ON_YOU -<v:shape id="" type="#_x0000_t202" +<v:shape id="#{@id}" type="#_x0000_t202" style='position:absolute;margin-left:104pt;margin-top:2pt;width:800px;height:27pt;z-index:1;mso-wrap-style:tight' fillcolor="#ffffa1 [80]" o:insetmode="auto"> diff --git a/lib/axlsx/util/simple_typed_list.rb b/lib/axlsx/util/simple_typed_list.rb index 8fc4795a..e3336678 100644 --- a/lib/axlsx/util/simple_typed_list.rb +++ b/lib/axlsx/util/simple_typed_list.rb @@ -155,19 +155,6 @@ module Axlsx str << '</' << el_name << '>' end - # Serializes the list - # If the serialize_as property is set, it is used as the parent node name. - # If the serialize_as property is nil, the first item in the list of allowed_types will be used, having the first letter of the class changed to lower case. - # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to. - # @return [String] - def to_xml(xml) - classname = @allowed_types[0].name.split('::').last - el_name = serialize_as || (classname[0,1].downcase + classname[1..-1]) - xml.send(el_name, :count=>@list.size) { - @list.each { |item| item.to_xml(xml) } - } - end - end diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index c58ede3a..2684af75 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -261,9 +261,8 @@ module Axlsx # @return [String] def run_xml_string(str = '') if is_text_run? - data = self.instance_values.reject{|key, value| value == nil } + data = instance_values.reject{|key, value| value == nil || key == 'value' || key == 'type' } keys = data.keys & INLINE_STYLES - keys.delete ['value', 'type'] str << "<r><rPr>" keys.each do |key| case key @@ -272,7 +271,7 @@ module Axlsx when 'color' str << data[key].to_xml_string else - "<" << key.to_s << " val='" << data[key].to_s << "'/>" + str << "<" << key.to_s << " val='" << data[key].to_s << "'/>" end end str << "</rPr>" << "<t>" << value.to_s << "</t></r>" diff --git a/lib/axlsx/workbook/worksheet/comment.rb b/lib/axlsx/workbook/worksheet/comment.rb index f3d19e13..0394d7c8 100644 --- a/lib/axlsx/workbook/worksheet/comment.rb +++ b/lib/axlsx/workbook/worksheet/comment.rb @@ -41,12 +41,6 @@ module Axlsx @vml_shape ||= initialize_vml_shape end - # The index of this comment - # @return [Integer] - def index - @comments.index(self) - end - # # The index of this author in a unique sorted list of all authors in # the comment. diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index dfa7fbdc..66d4b67c 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -482,13 +482,13 @@ module Axlsx page_margins.to_xml_string(str) if @page_margins page_setup.to_xml_string(str) if @page_setup str.concat "<drawing r:id='rId1'></drawing>" if @drawing - unless @tables.empty? + str << '<legacyDrawing r:id="rId1"/>' if @comments.size > 0 + unless @tables.empty? str.concat "<tableParts count='%s'>%s</tableParts>" % [@tables.size, @tables.reduce('') { |memo, obj| memo += "<tablePart r:id='%s'/>" % obj.rId }] end @conditional_formattings.each do |cf| str.concat cf.to_xml_string end - str << '<legacyDrawing r:id="rId1"/>' if @comments.size > 0 str + '</worksheet>' end |
