write_xlsx 1.12.1 → 1.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.rubocop.yml +12 -0
 - data/Changes +6 -0
 - data/LICENSE.txt +1 -1
 - data/examples/autofilter.rb +1 -2
 - data/examples/colors.rb +4 -4
 - data/examples/formats.rb +14 -14
 - data/lib/write_xlsx/chart/area.rb +1 -1
 - data/lib/write_xlsx/chart/axis.rb +4 -4
 - data/lib/write_xlsx/chart/bar.rb +1 -1
 - data/lib/write_xlsx/chart/caption.rb +8 -4
 - data/lib/write_xlsx/chart/column.rb +1 -1
 - data/lib/write_xlsx/chart/doughnut.rb +2 -2
 - data/lib/write_xlsx/chart/line.rb +1 -1
 - data/lib/write_xlsx/chart/pie.rb +2 -2
 - data/lib/write_xlsx/chart/radar.rb +1 -1
 - data/lib/write_xlsx/chart/scatter.rb +1 -1
 - data/lib/write_xlsx/chart/series.rb +10 -20
 - data/lib/write_xlsx/chart/stock.rb +1 -1
 - data/lib/write_xlsx/chart.rb +14 -21
 - data/lib/write_xlsx/chartsheet.rb +3 -3
 - data/lib/write_xlsx/drawing.rb +108 -114
 - data/lib/write_xlsx/format.rb +20 -24
 - data/lib/write_xlsx/image.rb +89 -0
 - data/lib/write_xlsx/image_property.rb +163 -0
 - data/lib/write_xlsx/inserted_chart.rb +42 -0
 - data/lib/write_xlsx/package/app.rb +1 -0
 - data/lib/write_xlsx/package/button.rb +58 -5
 - data/lib/write_xlsx/package/conditional_format.rb +4 -4
 - data/lib/write_xlsx/package/packager.rb +22 -27
 - data/lib/write_xlsx/package/rich_value.rb +1 -1
 - data/lib/write_xlsx/package/styles.rb +1 -1
 - data/lib/write_xlsx/package/vml.rb +10 -19
 - data/lib/write_xlsx/shape.rb +3 -2
 - data/lib/write_xlsx/sparkline.rb +1 -1
 - data/lib/write_xlsx/utility.rb +8 -203
 - data/lib/write_xlsx/version.rb +1 -1
 - data/lib/write_xlsx/workbook.rb +87 -175
 - data/lib/write_xlsx/worksheet/data_validation.rb +1 -1
 - data/lib/write_xlsx/worksheet/hyperlink.rb +2 -2
 - data/lib/write_xlsx/worksheet.rb +478 -484
 - data/lib/write_xlsx/zip_file_utils.rb +2 -2
 - data/write_xlsx.gemspec +3 -3
 - metadata +15 -9
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 73aab5eb08b0bd985cad2f77620ef0b9c44a383d0e98a598428c1385e544963a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 20bdb3eaab4895e2378659137e1eb84b62daee5563b2c7bd350e421a77dd1ff8
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 21519073cbab6a3b3397afe389e055334b1b0f415a5d4c2e7196e13b6d31e98c47894dd59fc9646c4eb884a9882fb2ad05d4d50a97222a9a2f9a383197e0d75a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: aec12c29800ed6c0054bb1c705a3ef40a615ef975ef0911978b56dfe051a3f44b4e8644186d9c2f13458f455cf3a25769a8651bd631ab121094fd4edcb0e0a86
         
     | 
    
        data/.rubocop.yml
    CHANGED
    
    | 
         @@ -17,6 +17,9 @@ Gemspec/RequiredRubyVersion: 
     | 
|
| 
       17 
17 
     | 
    
         
             
            Gemspec/RequireMFA:
         
     | 
| 
       18 
18 
     | 
    
         
             
              Enabled: false
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
      
 20 
     | 
    
         
            +
            Layout/ArgumentAlignment:
         
     | 
| 
      
 21 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       20 
23 
     | 
    
         
             
            Layout/EndOfLine:
         
     | 
| 
       21 
24 
     | 
    
         
             
              EnforcedStyle: lf
         
     | 
| 
       22 
25 
     | 
    
         | 
| 
         @@ -76,6 +79,9 @@ Metrics/ParameterLists: 
     | 
|
| 
       76 
79 
     | 
    
         
             
            Metrics/PerceivedComplexity:
         
     | 
| 
       77 
80 
     | 
    
         
             
              Max: 50
         
     | 
| 
       78 
81 
     | 
    
         | 
| 
      
 82 
     | 
    
         
            +
            Minitest/UselessAssertion:
         
     | 
| 
      
 83 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
       79 
85 
     | 
    
         
             
            Naming/HeredocDelimiterNaming:
         
     | 
| 
       80 
86 
     | 
    
         
             
              Enabled: false
         
     | 
| 
       81 
87 
     | 
    
         | 
| 
         @@ -85,6 +91,9 @@ Naming/MethodName: 
     | 
|
| 
       85 
91 
     | 
    
         
             
            Naming/MethodParameterName:
         
     | 
| 
       86 
92 
     | 
    
         
             
              Enabled: false
         
     | 
| 
       87 
93 
     | 
    
         | 
| 
      
 94 
     | 
    
         
            +
            Naming/PredicateMethod:
         
     | 
| 
      
 95 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
       88 
97 
     | 
    
         
             
            Naming/VariableNumber:
         
     | 
| 
       89 
98 
     | 
    
         
             
              Enabled: false
         
     | 
| 
       90 
99 
     | 
    
         | 
| 
         @@ -104,6 +113,9 @@ Style/FormatString: 
     | 
|
| 
       104 
113 
     | 
    
         
             
            Style/FormatStringToken:
         
     | 
| 
       105 
114 
     | 
    
         
             
              EnforcedStyle: unannotated
         
     | 
| 
       106 
115 
     | 
    
         | 
| 
      
 116 
     | 
    
         
            +
            Style/HashSlice:
         
     | 
| 
      
 117 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
       107 
119 
     | 
    
         
             
            Style/HashSyntax:
         
     | 
| 
       108 
120 
     | 
    
         
             
              EnforcedStyle: ruby19_no_mixed_keys
         
     | 
| 
       109 
121 
     | 
    
         
             
              EnforcedShorthandSyntax: either
         
     | 
    
        data/Changes
    CHANGED
    
    | 
         @@ -1,5 +1,11 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Change history of write_xlsx rubygem.
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            2025-10-28 v1.12.3
         
     | 
| 
      
 4 
     | 
    
         
            +
                fix compatibility with rubyzip 3.x
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            2025-09-08 v1.12.2
         
     | 
| 
      
 7 
     | 
    
         
            +
                Fix Update gemspec: require rubyzip ~> 2.4.0
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       3 
9 
     | 
    
         
             
            2024-04-12 v1.12.1
         
     | 
| 
       4 
10 
     | 
    
         
             
                Added support for embedding images into worksheets with
         
     | 
| 
       5 
11 
     | 
    
         
             
                worksheet `embed_image()`.
         
     | 
    
        data/LICENSE.txt
    CHANGED
    
    
    
        data/examples/autofilter.rb
    CHANGED
    
    | 
         @@ -28,8 +28,7 @@ bold = workbook.add_format(bold: 1) 
     | 
|
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
            # Extract the data embedded at the end of this file.
         
     | 
| 
       30 
30 
     | 
    
         
             
            headings = DATA.gets.split
         
     | 
| 
       31 
     | 
    
         
            -
            data =  
     | 
| 
       32 
     | 
    
         
            -
            DATA.each { |line| data << line.split }
         
     | 
| 
      
 31 
     | 
    
         
            +
            data = DATA.map(&:split)
         
     | 
| 
       33 
32 
     | 
    
         | 
| 
       34 
33 
     | 
    
         
             
            # Set up several sheets with the same data.
         
     | 
| 
       35 
34 
     | 
    
         
             
            workbook.worksheets.each do |worksheet|
         
     | 
    
        data/examples/colors.rb
    CHANGED
    
    | 
         @@ -116,12 +116,12 @@ worksheet2.write(0, 3, "Name",  heading) 
     | 
|
| 
       116 
116 
     | 
    
         
             
                border:   1
         
     | 
| 
       117 
117 
     | 
    
         
             
              )
         
     | 
| 
       118 
118 
     | 
    
         | 
| 
       119 
     | 
    
         
            -
              worksheet2.write( 
     | 
| 
       120 
     | 
    
         
            -
              worksheet2.write( 
     | 
| 
       121 
     | 
    
         
            -
              worksheet2.write( 
     | 
| 
      
 119 
     | 
    
         
            +
              worksheet2.write(i - 7, 0, i,                    center)
         
     | 
| 
      
 120 
     | 
    
         
            +
              worksheet2.write(i - 7, 1, sprintf("0x%02X", i), center)
         
     | 
| 
      
 121 
     | 
    
         
            +
              worksheet2.write(i - 7, 2, '',                   format)
         
     | 
| 
       122 
122 
     | 
    
         | 
| 
       123 
123 
     | 
    
         
             
              # Add the  color names
         
     | 
| 
       124 
     | 
    
         
            -
              worksheet2.write( 
     | 
| 
      
 124 
     | 
    
         
            +
              worksheet2.write(i - 7, 3, colors[i], center) if colors.has_key?(i)
         
     | 
| 
       125 
125 
     | 
    
         
             
            end
         
     | 
| 
       126 
126 
     | 
    
         | 
| 
       127 
127 
     | 
    
         
             
            #
         
     | 
    
        data/examples/formats.rb
    CHANGED
    
    | 
         @@ -147,12 +147,12 @@ def standard_colors(workbook, center, heading, colors) 
     | 
|
| 
       147 
147 
     | 
    
         
             
                  border:   1
         
     | 
| 
       148 
148 
     | 
    
         
             
                )
         
     | 
| 
       149 
149 
     | 
    
         | 
| 
       150 
     | 
    
         
            -
                worksheet.write( 
     | 
| 
       151 
     | 
    
         
            -
                worksheet.write( 
     | 
| 
       152 
     | 
    
         
            -
                worksheet.write( 
     | 
| 
      
 150 
     | 
    
         
            +
                worksheet.write(i - 7, 0, i, center)
         
     | 
| 
      
 151 
     | 
    
         
            +
                worksheet.write(i - 7, 1, sprintf("0x%02X", i), center)
         
     | 
| 
      
 152 
     | 
    
         
            +
                worksheet.write(i - 7, 2, '', format)
         
     | 
| 
       153 
153 
     | 
    
         | 
| 
       154 
154 
     | 
    
         
             
                # Add the  color names
         
     | 
| 
       155 
     | 
    
         
            -
                worksheet.write( 
     | 
| 
      
 155 
     | 
    
         
            +
                worksheet.write(i - 7, 3, colors[i], center) if colors[i]
         
     | 
| 
       156 
156 
     | 
    
         
             
              end
         
     | 
| 
       157 
157 
     | 
    
         
             
            end
         
     | 
| 
       158 
158 
     | 
    
         | 
| 
         @@ -294,11 +294,11 @@ def borders(workbook, center, heading, _colors) 
     | 
|
| 
       294 
294 
     | 
    
         
             
                format.set_border_color('red')
         
     | 
| 
       295 
295 
     | 
    
         
             
                format.set_align('center')
         
     | 
| 
       296 
296 
     | 
    
         | 
| 
       297 
     | 
    
         
            -
                worksheet.write( 
     | 
| 
       298 
     | 
    
         
            -
                worksheet.write( 
     | 
| 
      
 297 
     | 
    
         
            +
                worksheet.write(2 * (i + 1), 0, i, center)
         
     | 
| 
      
 298 
     | 
    
         
            +
                worksheet.write(2 * (i + 1),
         
     | 
| 
       299 
299 
     | 
    
         
             
                                1, sprintf("0x%02X", i), center)
         
     | 
| 
       300 
300 
     | 
    
         | 
| 
       301 
     | 
    
         
            -
                worksheet.write( 
     | 
| 
      
 301 
     | 
    
         
            +
                worksheet.write(2 * (i + 1), 3, "Border", format)
         
     | 
| 
       302 
302 
     | 
    
         
             
              end
         
     | 
| 
       303 
303 
     | 
    
         | 
| 
       304 
304 
     | 
    
         
             
              worksheet.write(30, 0, "Diag type",             heading)
         
     | 
| 
         @@ -313,11 +313,11 @@ def borders(workbook, center, heading, _colors) 
     | 
|
| 
       313 
313 
     | 
    
         
             
                format.set_diag_color('red')
         
     | 
| 
       314 
314 
     | 
    
         
             
                format.set_align('center')
         
     | 
| 
       315 
315 
     | 
    
         | 
| 
       316 
     | 
    
         
            -
                worksheet.write( 
     | 
| 
       317 
     | 
    
         
            -
                worksheet.write( 
     | 
| 
      
 316 
     | 
    
         
            +
                worksheet.write(2 * (i + 15), 0, i, center)
         
     | 
| 
      
 317 
     | 
    
         
            +
                worksheet.write(2 * (i + 15),
         
     | 
| 
       318 
318 
     | 
    
         
             
                                1, sprintf("0x%02X", i), center)
         
     | 
| 
       319 
319 
     | 
    
         | 
| 
       320 
     | 
    
         
            -
                worksheet.write( 
     | 
| 
      
 320 
     | 
    
         
            +
                worksheet.write(2 * (i + 15), 3, "Border", format)
         
     | 
| 
       321 
321 
     | 
    
         
             
              end
         
     | 
| 
       322 
322 
     | 
    
         
             
            end
         
     | 
| 
       323 
323 
     | 
    
         | 
| 
         @@ -348,14 +348,14 @@ def patterns(workbook, center, heading, _colors) 
     | 
|
| 
       348 
348 
     | 
    
         
             
                format.set_fg_color('green')
         
     | 
| 
       349 
349 
     | 
    
         
             
                format.set_align('center')
         
     | 
| 
       350 
350 
     | 
    
         | 
| 
       351 
     | 
    
         
            -
                worksheet.write( 
     | 
| 
       352 
     | 
    
         
            -
                worksheet.write( 
     | 
| 
      
 351 
     | 
    
         
            +
                worksheet.write(2 * (i + 1), 0, i, center)
         
     | 
| 
      
 352 
     | 
    
         
            +
                worksheet.write(2 * (i + 1),
         
     | 
| 
       353 
353 
     | 
    
         
             
                                1, sprintf("0x%02X", i), center)
         
     | 
| 
       354 
354 
     | 
    
         | 
| 
       355 
     | 
    
         
            -
                worksheet.write( 
     | 
| 
      
 355 
     | 
    
         
            +
                worksheet.write(2 * (i + 1), 3, "Pattern", format)
         
     | 
| 
       356 
356 
     | 
    
         | 
| 
       357 
357 
     | 
    
         
             
                if i == 1
         
     | 
| 
       358 
     | 
    
         
            -
                  worksheet.write( 
     | 
| 
      
 358 
     | 
    
         
            +
                  worksheet.write(2 * (i + 1),
         
     | 
| 
       359 
359 
     | 
    
         
             
                                  5, "This is solid colour, the most useful pattern.", heading)
         
     | 
| 
       360 
360 
     | 
    
         
             
                end
         
     | 
| 
       361 
361 
     | 
    
         
             
              end
         
     | 
| 
         @@ -45,7 +45,7 @@ module Writexlsx 
     | 
|
| 
       45 
45 
     | 
    
         
             
                    set_axis_line(args)
         
     | 
| 
       46 
46 
     | 
    
         
             
                    set_axis_fill(args)
         
     | 
| 
       47 
47 
     | 
    
         
             
                    if ptrue?(args[:text_axis])
         
     | 
| 
       48 
     | 
    
         
            -
                       
     | 
| 
      
 48 
     | 
    
         
            +
                      chart.date_category = false
         
     | 
| 
       49 
49 
     | 
    
         
             
                      @text_axis = true
         
     | 
| 
       50 
50 
     | 
    
         
             
                    end
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
         @@ -178,15 +178,15 @@ module Writexlsx 
     | 
|
| 
       178 
178 
     | 
    
         
             
                  end
         
     | 
| 
       179 
179 
     | 
    
         | 
| 
       180 
180 
     | 
    
         
             
                  def set_axis_name_layout(args)
         
     | 
| 
       181 
     | 
    
         
            -
                    @layout    =  
     | 
| 
      
 181 
     | 
    
         
            +
                    @layout    = chart.layout_properties(args[:name_layout], 1)
         
     | 
| 
       182 
182 
     | 
    
         
             
                  end
         
     | 
| 
       183 
183 
     | 
    
         | 
| 
       184 
184 
     | 
    
         
             
                  def set_axis_line(args)
         
     | 
| 
       185 
     | 
    
         
            -
                    @line =  
     | 
| 
      
 185 
     | 
    
         
            +
                    @line = chart.line_properties(args[:line])
         
     | 
| 
       186 
186 
     | 
    
         
             
                  end
         
     | 
| 
       187 
187 
     | 
    
         | 
| 
       188 
188 
     | 
    
         
             
                  def set_axis_fill(args)
         
     | 
| 
       189 
     | 
    
         
            -
                    @fill =  
     | 
| 
      
 189 
     | 
    
         
            +
                    @fill = chart.fill_properties(args[:fill])
         
     | 
| 
       190 
190 
     | 
    
         
             
                  end
         
     | 
| 
       191 
191 
     | 
    
         
             
                end
         
     | 
| 
       192 
192 
     | 
    
         
             
              end
         
     | 
    
        data/lib/write_xlsx/chart/bar.rb
    CHANGED
    
    
| 
         @@ -14,10 +14,10 @@ module Writexlsx 
     | 
|
| 
       14 
14 
     | 
    
         
             
                  end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
                  def merge_with_hash(params) # :nodoc:
         
     | 
| 
       17 
     | 
    
         
            -
                    @name, @formula =  
     | 
| 
       18 
     | 
    
         
            -
                    @data_id 
     | 
| 
       19 
     | 
    
         
            -
                    @name_font 
     | 
| 
       20 
     | 
    
         
            -
                    @layout 
     | 
| 
      
 17 
     | 
    
         
            +
                    @name, @formula = chart.process_names(params[:name], params[:name_formula])
         
     | 
| 
      
 18 
     | 
    
         
            +
                    @data_id   = chart.data_id(@formula, params[:data])
         
     | 
| 
      
 19 
     | 
    
         
            +
                    @name_font = convert_font_args(params[:name_font])
         
     | 
| 
      
 20 
     | 
    
         
            +
                    @layout    = chart.layout_properties(params[:layout], 1)
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
                    # Set the title overlay option.
         
     | 
| 
       23 
23 
     | 
    
         
             
                    @overlay  = params[:overlay]
         
     | 
| 
         @@ -25,6 +25,10 @@ module Writexlsx 
     | 
|
| 
       25 
25 
     | 
    
         
             
                    # Set the no automatic title option.
         
     | 
| 
       26 
26 
     | 
    
         
             
                    @none = params[:none]
         
     | 
| 
       27 
27 
     | 
    
         
             
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  private
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                  attr_reader :chart
         
     | 
| 
       28 
32 
     | 
    
         
             
                end
         
     | 
| 
       29 
33 
     | 
    
         
             
              end
         
     | 
| 
       30 
34 
     | 
    
         
             
            end
         
     | 
| 
         @@ -24,7 +24,7 @@ module Writexlsx 
     | 
|
| 
       24 
24 
     | 
    
         
             
                  include Writexlsx::Utility
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
                  def initialize(subtype)
         
     | 
| 
       27 
     | 
    
         
            -
                    super 
     | 
| 
      
 27 
     | 
    
         
            +
                    super
         
     | 
| 
       28 
28 
     | 
    
         
             
                    @vary_data_color = 1
         
     | 
| 
       29 
29 
     | 
    
         
             
                    @hole_size       = 50
         
     | 
| 
       30 
30 
     | 
    
         
             
                    @rotation        = 0
         
     | 
| 
         @@ -38,7 +38,7 @@ module Writexlsx 
     | 
|
| 
       38 
38 
     | 
    
         
             
                  def set_hole_size(size)
         
     | 
| 
       39 
39 
     | 
    
         
             
                    return unless size
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
                    if size 
     | 
| 
      
 41 
     | 
    
         
            +
                    if size.between?(10, 90)
         
     | 
| 
       42 
42 
     | 
    
         
             
                      @hole_size = size
         
     | 
| 
       43 
43 
     | 
    
         
             
                    else
         
     | 
| 
       44 
44 
     | 
    
         
             
                      raise "Hole size $size outside Excel range: 10 <= size <= 90"
         
     | 
    
        data/lib/write_xlsx/chart/pie.rb
    CHANGED
    
    | 
         @@ -29,7 +29,7 @@ module Writexlsx 
     | 
|
| 
       29 
29 
     | 
    
         
             
                  include Writexlsx::Utility
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
31 
     | 
    
         
             
                  def initialize(subtype)
         
     | 
| 
       32 
     | 
    
         
            -
                    super 
     | 
| 
      
 32 
     | 
    
         
            +
                    super
         
     | 
| 
       33 
33 
     | 
    
         
             
                    @vary_data_color = 1
         
     | 
| 
       34 
34 
     | 
    
         
             
                    @rotation        = 0
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
         @@ -50,7 +50,7 @@ module Writexlsx 
     | 
|
| 
       50 
50 
     | 
    
         
             
                  def set_rotation(rotation)
         
     | 
| 
       51 
51 
     | 
    
         
             
                    return unless rotation
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
                    if rotation 
     | 
| 
      
 53 
     | 
    
         
            +
                    if rotation.between?(0, 360)
         
     | 
| 
       54 
54 
     | 
    
         
             
                      @rotation = rotation
         
     | 
| 
       55 
55 
     | 
    
         
             
                    else
         
     | 
| 
       56 
56 
     | 
    
         
             
                      raise "Chart rotation $rotation outside range: 0 <= rotation <= 360"
         
     | 
| 
         @@ -51,7 +51,7 @@ module Writexlsx 
     | 
|
| 
       51 
51 
     | 
    
         
             
                  attr_reader :visible
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
53 
     | 
    
         
             
                  def initialize(params)
         
     | 
| 
       54 
     | 
    
         
            -
                    super 
     | 
| 
      
 54 
     | 
    
         
            +
                    super
         
     | 
| 
       55 
55 
     | 
    
         
             
                    @visible = params[:visible]
         
     | 
| 
       56 
56 
     | 
    
         
             
                  end
         
     | 
| 
       57 
57 
     | 
    
         
             
                end
         
     | 
| 
         @@ -62,7 +62,7 @@ module Writexlsx 
     | 
|
| 
       62 
62 
     | 
    
         
             
                  attr_reader :label
         
     | 
| 
       63 
63 
     | 
    
         | 
| 
       64 
64 
     | 
    
         
             
                  def initialize(params)
         
     | 
| 
       65 
     | 
    
         
            -
                    super 
     | 
| 
      
 65 
     | 
    
         
            +
                    super
         
     | 
| 
       66 
66 
     | 
    
         | 
| 
       67 
67 
     | 
    
         
             
                    @label = trendline_label_properties(params[:label])
         
     | 
| 
       68 
68 
     | 
    
         | 
| 
         @@ -98,17 +98,15 @@ module Writexlsx 
     | 
|
| 
       98 
98 
     | 
    
         
             
                    # Allow 'border' as a synonym for 'line'.
         
     | 
| 
       99 
99 
     | 
    
         
             
                    line = line_properties(_label[:border]) if ptrue?(_label[:border])
         
     | 
| 
       100 
100 
     | 
    
         | 
| 
       101 
     | 
    
         
            -
                    # Set the fill properties for the label.
         
     | 
| 
       102 
     | 
    
         
            -
                    fill = fill_properties(_label[:fill])
         
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
101 
     | 
    
         
             
                    # Set the pattern properties for the label.
         
     | 
| 
       105 
102 
     | 
    
         
             
                    pattern = pattern_properties(_label[:pattern])
         
     | 
| 
       106 
103 
     | 
    
         | 
| 
       107 
104 
     | 
    
         
             
                    # Set the gradient fill properties for the label.
         
     | 
| 
       108 
105 
     | 
    
         
             
                    gradient = gradient_properties(_label[:gradient])
         
     | 
| 
       109 
106 
     | 
    
         | 
| 
      
 107 
     | 
    
         
            +
                    # Set the fill properties for the label.
         
     | 
| 
       110 
108 
     | 
    
         
             
                    # Pattern fill overrides solid fill.
         
     | 
| 
       111 
     | 
    
         
            -
                    fill = nil  
     | 
| 
      
 109 
     | 
    
         
            +
                    fill = pattern ? nil : fill_properties(_label[:fill])
         
     | 
| 
       112 
110 
     | 
    
         | 
| 
       113 
111 
     | 
    
         
             
                    # Gradient fill overrides solid and pattern fills.
         
     | 
| 
       114 
112 
     | 
    
         
             
                    if ptrue?(gradient)
         
     | 
| 
         @@ -140,7 +138,7 @@ module Writexlsx 
     | 
|
| 
       140 
138 
     | 
    
         
             
                  attr_reader :size
         
     | 
| 
       141 
139 
     | 
    
         | 
| 
       142 
140 
     | 
    
         
             
                  def initialize(params)
         
     | 
| 
       143 
     | 
    
         
            -
                    super 
     | 
| 
      
 141 
     | 
    
         
            +
                    super
         
     | 
| 
       144 
142 
     | 
    
         | 
| 
       145 
143 
     | 
    
         
             
                    @type = value_or_raise(types, params[:type], 'maker type') if params[:type]
         
     | 
| 
       146 
144 
     | 
    
         | 
| 
         @@ -354,13 +352,7 @@ module Writexlsx 
     | 
|
| 
       354 
352 
     | 
    
         
             
                    end
         
     | 
| 
       355 
353 
     | 
    
         | 
| 
       356 
354 
     | 
    
         
             
                    # Set the line properties for the data labels.
         
     | 
| 
       357 
     | 
    
         
            -
                    line = line_properties(labels[:line])
         
     | 
| 
       358 
     | 
    
         
            -
             
     | 
| 
       359 
     | 
    
         
            -
                    # Allow 'border' as a synonym for 'line'.
         
     | 
| 
       360 
     | 
    
         
            -
                    line = line_properties(labels[:border]) if labels[:border]
         
     | 
| 
       361 
     | 
    
         
            -
             
     | 
| 
       362 
     | 
    
         
            -
                    # Set the fill properties for the labels.
         
     | 
| 
       363 
     | 
    
         
            -
                    fill = fill_properties(labels[:fill])
         
     | 
| 
      
 355 
     | 
    
         
            +
                    line = line_properties(labels[:border] || labels[:line])
         
     | 
| 
       364 
356 
     | 
    
         | 
| 
       365 
357 
     | 
    
         
             
                    # Set the pattern properties for the labels.
         
     | 
| 
       366 
358 
     | 
    
         
             
                    pattern = pattern_properties(labels[:pattern])
         
     | 
| 
         @@ -368,8 +360,8 @@ module Writexlsx 
     | 
|
| 
       368 
360 
     | 
    
         
             
                    # Set the gradient fill properties for the labels.
         
     | 
| 
       369 
361 
     | 
    
         
             
                    gradient = gradient_properties(labels[:gradient])
         
     | 
| 
       370 
362 
     | 
    
         | 
| 
       371 
     | 
    
         
            -
                    #  
     | 
| 
       372 
     | 
    
         
            -
                    fill = nil  
     | 
| 
      
 363 
     | 
    
         
            +
                    # Set the fill properties for the labels.
         
     | 
| 
      
 364 
     | 
    
         
            +
                    fill = pattern ? nil : fill_properties(labels[:fill])
         
     | 
| 
       373 
365 
     | 
    
         | 
| 
       374 
366 
     | 
    
         
             
                    # Gradient fill overrides solid and pattern fills.
         
     | 
| 
       375 
367 
     | 
    
         
             
                    if gradient
         
     | 
| 
         @@ -412,7 +404,8 @@ module Writexlsx 
     | 
|
| 
       412 
404 
     | 
    
         
             
                        line = line_properties(property[:border] || property[:line])
         
     | 
| 
       413 
405 
     | 
    
         | 
| 
       414 
406 
     | 
    
         
             
                        # Set the fill properties for the labels.
         
     | 
| 
       415 
     | 
    
         
            -
                        fill  
     | 
| 
      
 407 
     | 
    
         
            +
                        # Pattern fill overrides solid fill.
         
     | 
| 
      
 408 
     | 
    
         
            +
                        fill = pattern ? nil : fill_properties(property[:fill])
         
     | 
| 
       416 
409 
     | 
    
         | 
| 
       417 
410 
     | 
    
         
             
                        # Set the pattern properties for the labels.
         
     | 
| 
       418 
411 
     | 
    
         
             
                        pattern = pattern_properties(property[:pattern])
         
     | 
| 
         @@ -420,9 +413,6 @@ module Writexlsx 
     | 
|
| 
       420 
413 
     | 
    
         
             
                        # Set the gradient fill properties for the labels.
         
     | 
| 
       421 
414 
     | 
    
         
             
                        gradient = gradient_properties(property[:gradient])
         
     | 
| 
       422 
415 
     | 
    
         | 
| 
       423 
     | 
    
         
            -
                        # Pattern fill overrides solid fill.
         
     | 
| 
       424 
     | 
    
         
            -
                        fill = nil if pattern
         
     | 
| 
       425 
     | 
    
         
            -
             
     | 
| 
       426 
416 
     | 
    
         
             
                        # Gradient fill overrides solid and pattern fills.
         
     | 
| 
       427 
417 
     | 
    
         
             
                        if gradient
         
     | 
| 
       428 
418 
     | 
    
         
             
                          pattern = nil
         
     | 
    
        data/lib/write_xlsx/chart.rb
    CHANGED
    
    | 
         @@ -17,9 +17,9 @@ module Writexlsx 
     | 
|
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
                def initialize(params = {})
         
     | 
| 
       19 
19 
     | 
    
         
             
                  @horizontal = true
         
     | 
| 
       20 
     | 
    
         
            -
                  @vertical 
     | 
| 
       21 
     | 
    
         
            -
                  @outline 
     | 
| 
       22 
     | 
    
         
            -
                  @show_keys 
     | 
| 
      
 20 
     | 
    
         
            +
                  @vertical   = true
         
     | 
| 
      
 21 
     | 
    
         
            +
                  @outline    = true
         
     | 
| 
      
 22 
     | 
    
         
            +
                  @show_keys  = false
         
     | 
| 
       23 
23 
     | 
    
         
             
                  @horizontal = params[:horizontal] if params.has_key?(:horizontal)
         
     | 
| 
       24 
24 
     | 
    
         
             
                  @vertical   = params[:vertical]   if params.has_key?(:vertical)
         
     | 
| 
       25 
25 
     | 
    
         
             
                  @outline    = params[:outline]    if params.has_key?(:outline)
         
     | 
| 
         @@ -218,7 +218,7 @@ module Writexlsx 
     | 
|
| 
       218 
218 
     | 
    
         
             
                  @subtype           = subtype
         
     | 
| 
       219 
219 
     | 
    
         
             
                  @sheet_type        = 0x0200
         
     | 
| 
       220 
220 
     | 
    
         
             
                  @series            = []
         
     | 
| 
       221 
     | 
    
         
            -
                  @embedded          =  
     | 
| 
      
 221 
     | 
    
         
            +
                  @embedded          = false
         
     | 
| 
       222 
222 
     | 
    
         
             
                  @id                = -1
         
     | 
| 
       223 
223 
     | 
    
         
             
                  @series_index      = 0
         
     | 
| 
       224 
224 
     | 
    
         
             
                  @style_id          = 2
         
     | 
| 
         @@ -257,7 +257,7 @@ module Writexlsx 
     | 
|
| 
       257 
257 
     | 
    
         
             
                      # Write the c:spPr element for the chartarea formatting.
         
     | 
| 
       258 
258 
     | 
    
         
             
                      write_sp_pr(@chartarea)
         
     | 
| 
       259 
259 
     | 
    
         
             
                      # Write the c:printSettings element.
         
     | 
| 
       260 
     | 
    
         
            -
                      write_print_settings if @embedded 
     | 
| 
      
 260 
     | 
    
         
            +
                      write_print_settings if @embedded
         
     | 
| 
       261 
261 
     | 
    
         
             
                    end
         
     | 
| 
       262 
262 
     | 
    
         
             
                  end
         
     | 
| 
       263 
263 
     | 
    
         
             
                end
         
     | 
| 
         @@ -462,7 +462,7 @@ module Writexlsx 
     | 
|
| 
       462 
462 
     | 
    
         
             
                # Setup the default configuration data for an embedded chart.
         
     | 
| 
       463 
463 
     | 
    
         
             
                #
         
     | 
| 
       464 
464 
     | 
    
         
             
                def set_embedded_config_data
         
     | 
| 
       465 
     | 
    
         
            -
                  @embedded =  
     | 
| 
      
 465 
     | 
    
         
            +
                  @embedded = true
         
     | 
| 
       466 
466 
     | 
    
         
             
                end
         
     | 
| 
       467 
467 
     | 
    
         | 
| 
       468 
468 
     | 
    
         
             
                #
         
     | 
| 
         @@ -480,7 +480,7 @@ module Writexlsx 
     | 
|
| 
       480 
480 
     | 
    
         
             
                  subtype = 'percentStacked' if subtype == 'percent_stacked'
         
     | 
| 
       481 
481 
     | 
    
         | 
| 
       482 
482 
     | 
    
         
             
                  # Set a default overlap for stacked charts.
         
     | 
| 
       483 
     | 
    
         
            -
                  @series_overlap_1 = 100 if @subtype =~  
     | 
| 
      
 483 
     | 
    
         
            +
                  @series_overlap_1 = 100 if @subtype =~ /stacked/ && !@series_overlap_1
         
     | 
| 
       484 
484 
     | 
    
         | 
| 
       485 
485 
     | 
    
         
             
                  @writer.tag_elements('c:barChart') do
         
     | 
| 
       486 
486 
     | 
    
         
             
                    # Write the c:barDir element.
         
     | 
| 
         @@ -1814,20 +1814,13 @@ module Writexlsx 
     | 
|
| 
       1814 
1814 
     | 
    
         
             
                # Write the <c:pageMargins> element.
         
     | 
| 
       1815 
1815 
     | 
    
         
             
                #
         
     | 
| 
       1816 
1816 
     | 
    
         
             
                def write_page_margins # :nodoc:
         
     | 
| 
       1817 
     | 
    
         
            -
                  b      = 0.75
         
     | 
| 
       1818 
     | 
    
         
            -
                  l      = 0.7
         
     | 
| 
       1819 
     | 
    
         
            -
                  r      = 0.7
         
     | 
| 
       1820 
     | 
    
         
            -
                  t      = 0.75
         
     | 
| 
       1821 
     | 
    
         
            -
                  header = 0.3
         
     | 
| 
       1822 
     | 
    
         
            -
                  footer = 0.3
         
     | 
| 
       1823 
     | 
    
         
            -
             
     | 
| 
       1824 
1817 
     | 
    
         
             
                  attributes = [
         
     | 
| 
       1825 
     | 
    
         
            -
                    ['b',       
     | 
| 
       1826 
     | 
    
         
            -
                    ['l',       
     | 
| 
       1827 
     | 
    
         
            -
                    ['r',       
     | 
| 
       1828 
     | 
    
         
            -
                    ['t',       
     | 
| 
       1829 
     | 
    
         
            -
                    ['header',  
     | 
| 
       1830 
     | 
    
         
            -
                    ['footer',  
     | 
| 
      
 1818 
     | 
    
         
            +
                    ['b',      0.75],
         
     | 
| 
      
 1819 
     | 
    
         
            +
                    ['l',      0.7],
         
     | 
| 
      
 1820 
     | 
    
         
            +
                    ['r',      0.7],
         
     | 
| 
      
 1821 
     | 
    
         
            +
                    ['t',      0.75],
         
     | 
| 
      
 1822 
     | 
    
         
            +
                    ['header', 0.3],
         
     | 
| 
      
 1823 
     | 
    
         
            +
                    ['footer', 0.3]
         
     | 
| 
       1831 
1824 
     | 
    
         
             
                  ]
         
     | 
| 
       1832 
1825 
     | 
    
         | 
| 
       1833 
1826 
     | 
    
         
             
                  @writer.empty_tag('c:pageMargins', attributes)
         
     | 
| 
         @@ -2872,7 +2865,7 @@ module Writexlsx 
     | 
|
| 
       2872 
2865 
     | 
    
         
             
                  colors    = gradient[:colors]
         
     | 
| 
       2873 
2866 
     | 
    
         | 
| 
       2874 
2867 
     | 
    
         
             
                  @writer.tag_elements('a:gsLst') do
         
     | 
| 
       2875 
     | 
    
         
            -
                    (0..colors.size - 1).each do |i|
         
     | 
| 
      
 2868 
     | 
    
         
            +
                    (0..(colors.size - 1)).each do |i|
         
     | 
| 
       2876 
2869 
     | 
    
         
             
                      pos = (positions[i] * 1000).to_i
         
     | 
| 
       2877 
2870 
     | 
    
         | 
| 
       2878 
2871 
     | 
    
         
             
                      attributes = [['pos', pos]]
         
     | 
| 
         @@ -203,9 +203,9 @@ module Writexlsx 
     | 
|
| 
       203 
203 
     | 
    
         
             
                # Write the <chartsheet> element. This is the root element of Chartsheet.
         
     | 
| 
       204 
204 
     | 
    
         
             
                #
         
     | 
| 
       205 
205 
     | 
    
         
             
                def write_chartsheet(&block) # :nodoc:
         
     | 
| 
       206 
     | 
    
         
            -
                  schema 
     | 
| 
       207 
     | 
    
         
            -
                  xmlns 
     | 
| 
       208 
     | 
    
         
            -
                  xmlns_r 
     | 
| 
      
 206 
     | 
    
         
            +
                  schema  = 'http://schemas.openxmlformats.org/'
         
     | 
| 
      
 207 
     | 
    
         
            +
                  xmlns   = schema + 'spreadsheetml/2006/main'
         
     | 
| 
      
 208 
     | 
    
         
            +
                  xmlns_r = schema + 'officeDocument/2006/relationships'
         
     | 
| 
       209 
209 
     | 
    
         | 
| 
       210 
210 
     | 
    
         
             
                  attributes = [
         
     | 
| 
       211 
211 
     | 
    
         
             
                    ['xmlns',   xmlns],
         
     |