write_xlsx 0.76.0 → 0.76.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15e9357295f571cfc282263876abdaf83e28e652
4
- data.tar.gz: 264a4bd65b91a39bc4cdabb518291a7df5894376
3
+ metadata.gz: 50ba1d56f0cd30c6747b137108d02434ae6fdf84
4
+ data.tar.gz: d02196b910a6f24fbbdd580fd00b7bb3f368c6e8
5
5
  SHA512:
6
- metadata.gz: 70bb93acf8c0ecb36ecc45e0c5cb4c1c64c502252878cd3d4bf1c4ab1ad9dd0940dd673cc67c1200d5964597207c678f0996deb4c2466e5bf7f1afb20390903f
7
- data.tar.gz: 3759ae9b833ca5e0138098b552370f9c7ab1daae3670c52a4b3539298de2d7aa219021eec5d9a9a475e12871bcd342799e17274acfb009d8028baf331fca8466
6
+ metadata.gz: a834e0b9894e75fddb5e2ba2c07c624f8fb46fbadff053cc4d67e6eae59d7b397b57db4662f5cfb2a92d0f2f6fe178864227935fd985c988827b5e1133df97d4
7
+ data.tar.gz: c22ff45ba70aa8d207e77994737b1ecde714c69fafe02d32de6580aaeafa3b72e84ccc4baac3b74dc90a2e12c01c941a63f089bd113b595c50c07cd8400f1319
data/Changes CHANGED
@@ -1,4 +1,7 @@
1
1
  Change history of write_xlsx rubygem.
2
+ 2014-03-21 v0.76.1
3
+ Fix for issue #7
4
+
2
5
  2014-01-31 v0.76.0
3
6
  Added date axis handling to charts.
4
7
  Added support for non-contiguous chart ranges.
@@ -20,17 +20,9 @@ def initialize(workbook, worksheet, row, col, string, options = {})
20
20
  options ||= {}
21
21
  @workbook = workbook
22
22
  @worksheet = worksheet
23
- @row = row
24
- @col = col
23
+ @row, @col = row, col
24
+ options_parse(row, col, options)
25
25
  @string = string[0, STR_MAX]
26
- @author = options[:author]
27
- @color = backgrount_color(options[:color] || DEFAULT_COLOR)
28
- @start_cell = options[:start_cell]
29
- @start_row, @start_col = if @start_cell
30
- substitute_cellref(@start_cell)
31
- else
32
- [ options[:start_row], options[:start_col] ]
33
- end
34
26
  @start_row ||= default_start_row(row)
35
27
  @start_col ||= default_start_col(col)
36
28
  @visible = options[:visible]
@@ -218,6 +210,26 @@ def write_client_data
218
210
  def writer=(w)
219
211
  @writer = w
220
212
  end
213
+
214
+ private
215
+
216
+ def options_parse(row, col, options)
217
+ @color = backgrount_color(options[:color] || DEFAULT_COLOR)
218
+ @author = options[:author]
219
+ @start_cell = options[:start_cell]
220
+ @start_row, @start_col = if @start_cell
221
+ substitute_cellref(@start_cell)
222
+ else
223
+ [ options[:start_row], options[:start_col] ]
224
+ end
225
+ @visible = options[:visible]
226
+ @x_offset = options[:x_offset] || default_x_offset(col)
227
+ @y_offset = options[:y_offset] || default_y_offset(row)
228
+ @x_scale = options[:x_scale] || 1
229
+ @y_scale = options[:y_scale] || 1
230
+ @width = (0.5 + (options[:width] || DEFAULT_WIDTH) * @x_scale).to_i
231
+ @height = (0.5 + (options[:height] || DEFAULT_HEIGHT) * @y_scale).to_i
232
+ end
221
233
  end
222
234
 
223
235
  class Comments
@@ -290,6 +302,7 @@ def has_comment_in_row?(row)
290
302
 
291
303
  private
292
304
 
305
+
293
306
  def comments_visible?
294
307
  @worksheet.comments_visible?
295
308
  end
@@ -1,5 +1,5 @@
1
1
  require 'write_xlsx/workbook'
2
2
 
3
3
  class WriteXLSX < Writexlsx::Workbook
4
- VERSION = "0.76.0"
4
+ VERSION = "0.76.1"
5
5
  end
@@ -120,7 +120,6 @@ def initialize(file, default_formats = {})
120
120
  @table_count = 0
121
121
  @image_types = {}
122
122
  @images = []
123
- @images_seen = {}
124
123
 
125
124
  # Structures for the shared strings data.
126
125
  @shared_strings = Package::SharedStrings.new
@@ -1730,20 +1729,18 @@ def prepare_drawings #:nodoc:
1730
1729
  #
1731
1730
  def get_image_properties(filename)
1732
1731
  previous_images = []
1732
+ images_seen = {}
1733
1733
  image_id = 1;
1734
- if @images_seen[filename]
1734
+ if images_seen[filename]
1735
1735
  # We've processed this file already.
1736
1736
  index = images_seen[filename] - 1
1737
-
1738
- # Increase image reference count.
1739
- image_data[index][0] += 1
1740
1737
  else
1741
1738
  # Open the image file and import the data.
1742
1739
  data = File.binread(filename)
1743
1740
  if data.unpack('x A3')[0] == 'PNG'
1744
1741
  # Test for PNGs.
1745
1742
  type, width, height = process_png(data)
1746
- image_types[:png] = 1
1743
+ @image_types[:png] = 1
1747
1744
  elsif data.unpack('n')[0] == 0xFFD8
1748
1745
  # Test for JPEG files.
1749
1746
  type, width, height = process_jpg(data, filename)
@@ -1757,11 +1754,11 @@ def get_image_properties(filename)
1757
1754
  raise "Unsupported image format for file: #{filename}\n"
1758
1755
  end
1759
1756
 
1760
- @images << [ filename, type]
1757
+ @images << [filename, type]
1761
1758
 
1762
1759
  # Also store new data for use in duplicate images.
1763
1760
  previous_images << [image_id, type, width, height]
1764
- @images_seen[filename] = image_id
1761
+ images_seen[filename] = image_id
1765
1762
  image_id += 1
1766
1763
  end
1767
1764
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: write_xlsx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.76.0
4
+ version: 0.76.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hideo NAKAMURA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-30 00:00:00.000000000 Z
11
+ date: 2014-03-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: write_xlsx is a gem to create a new file in the Excel 2007+ XLSX format.
14
14
  email:
@@ -1350,7 +1350,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1350
1350
  version: '0'
1351
1351
  requirements: []
1352
1352
  rubyforge_project:
1353
- rubygems_version: 2.2.0
1353
+ rubygems_version: 2.2.2
1354
1354
  signing_key:
1355
1355
  specification_version: 4
1356
1356
  summary: write_xlsx is a gem to create a new file in the Excel 2007+ XLSX format.
@@ -2546,3 +2546,4 @@ test_files:
2546
2546
  - test/worksheet/test_write_tab_color.rb
2547
2547
  - test/worksheet/test_write_url.rb
2548
2548
  - test/worksheet/test_write_worksheet_attributes.rb
2549
+ has_rdoc: