write_xlsx 0.76.0 → 0.76.1
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/Changes +3 -0
- data/lib/write_xlsx/package/comments.rb +23 -10
- data/lib/write_xlsx/version.rb +1 -1
- data/lib/write_xlsx/workbook.rb +5 -8
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50ba1d56f0cd30c6747b137108d02434ae6fdf84
|
4
|
+
data.tar.gz: d02196b910a6f24fbbdd580fd00b7bb3f368c6e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a834e0b9894e75fddb5e2ba2c07c624f8fb46fbadff053cc4d67e6eae59d7b397b57db4662f5cfb2a92d0f2f6fe178864227935fd985c988827b5e1133df97d4
|
7
|
+
data.tar.gz: c22ff45ba70aa8d207e77994737b1ecde714c69fafe02d32de6580aaeafa3b72e84ccc4baac3b74dc90a2e12c01c941a63f089bd113b595c50c07cd8400f1319
|
data/Changes
CHANGED
@@ -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
|
24
|
-
|
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
|
data/lib/write_xlsx/version.rb
CHANGED
data/lib/write_xlsx/workbook.rb
CHANGED
@@ -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
|
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 << [
|
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
|
-
|
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.
|
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-
|
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.
|
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:
|