write_xlsx 1.01.0 → 1.02.0
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 +8 -0
- data/README.md +1 -1
- data/lib/write_xlsx/drawing.rb +68 -32
- data/lib/write_xlsx/package/relationships.rb +2 -2
- data/lib/write_xlsx/utility.rb +19 -0
- data/lib/write_xlsx/version.rb +1 -1
- data/lib/write_xlsx/workbook.rb +13 -6
- data/lib/write_xlsx/worksheet.rb +58 -5
- data/lib/write_xlsx/worksheet/hyperlink.rb +16 -37
- data/test/drawing/test_drawing_chart_01.rb +1 -1
- data/test/drawing/test_drawing_image_01.rb +1 -1
- data/test/regression/test_hyperlink32.rb +27 -0
- data/test/regression/test_hyperlink33.rb +28 -0
- data/test/regression/test_hyperlink34.rb +33 -0
- data/test/regression/test_hyperlink35.rb +39 -0
- data/test/regression/test_hyperlink36.rb +34 -0
- data/test/regression/test_hyperlink37.rb +33 -0
- data/test/regression/test_hyperlink38.rb +27 -0
- data/test/regression/test_hyperlink39.rb +27 -0
- data/test/regression/test_hyperlink40.rb +27 -0
- data/test/regression/test_hyperlink41.rb +27 -0
- data/test/regression/test_hyperlink42.rb +27 -0
- data/test/regression/test_hyperlink43.rb +27 -0
- data/test/regression/test_hyperlink44.rb +27 -0
- data/test/regression/test_hyperlink45.rb +27 -0
- data/test/regression/test_hyperlink47.rb +27 -0
- data/test/regression/test_image06.rb +5 -5
- data/test/regression/xlsx_files/hyperlink32.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink33.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink34.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink35.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink36.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink37.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink38.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink39.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink40.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink41.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink42.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink43.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink44.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink45.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink47.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink48.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink49.xlsx +0 -0
- data/test/regression/xlsx_files/image06.xlsx +0 -0
- metadata +70 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd25c9e7242d84cbaa3f58304d292275f56e89353b61f151e9beb2bf9e740e46
|
4
|
+
data.tar.gz: 6ac71db1cf2089932e2381cb6c20d2b1fa0a82493bc00bafc307d4efbd2da048
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aada5fa6d8a1034743af39bcc352b2e15120493c47c4f048006f6db3869c3f1eb8652e437ffb4bdf441b0280596f314bc06d436178c4bd82ea39e8e9dafcc5b8
|
7
|
+
data.tar.gz: db54ce603031240fe4e5081603042f804a9dd4566e6bd4e5d1b7124fd9f064748654552bb7297881cfc72915e959f26c7459777fd4cceddaee27aeb726aec798
|
data/Changes
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
Change history of write_xlsx rubygem.
|
2
2
|
|
3
|
+
2021-02-12 v1.02.0
|
4
|
+
|
5
|
+
Added support for hyperlinks in worksheet images.
|
6
|
+
|
7
|
+
Increased allowable url length from 255 to 2079 characters, as allowed in
|
8
|
+
more recent versions of Excel.
|
9
|
+
|
10
|
+
|
3
11
|
2021-02-08 v1.01.0
|
4
12
|
|
5
13
|
Added support for stacked and East Asian vertical chart fonts.
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
gem to create a new file in the Excel 2007+ XLSX format, and you can use the
|
7
7
|
same interface as writeexcel gem. write_xlsx is converted from Perl's module
|
8
|
-
[Excel::Writer::XLSX-
|
8
|
+
[Excel::Writer::XLSX-1.02](https://github.com/jmcnamara/excel-writer-xlsx/tree/CPAN_1.02)
|
9
9
|
|
10
10
|
## Description
|
11
11
|
|
data/lib/write_xlsx/drawing.rb
CHANGED
@@ -4,11 +4,12 @@
|
|
4
4
|
|
5
5
|
module Writexlsx
|
6
6
|
class Drawing
|
7
|
-
attr_accessor :type, :dimensions, :width, :height, :
|
7
|
+
attr_accessor :type, :dimensions, :width, :height, :description, :shape, :anchor, :rel_index, :url_rel_index
|
8
|
+
attr_reader :tip
|
8
9
|
|
9
|
-
def initialize(type, dimensions, width, height,
|
10
|
-
@type, @dimensions, @width, @height, @
|
11
|
-
type, dimensions, width, height,
|
10
|
+
def initialize(type, dimensions, width, height, description, shape, anchor, rel_index = nil, url_rel_index = nil, tip = nil)
|
11
|
+
@type, @dimensions, @width, @height, @description, @shape, @anchor, @rel_index, @url_rel_index, @tip =
|
12
|
+
type, dimensions, width, height, description, shape, anchor, rel_index, url_rel_index, tip
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
@@ -82,12 +83,16 @@ def write_drawing_workspace
|
|
82
83
|
def write_two_cell_anchor(*args)
|
83
84
|
index, drawing = args
|
84
85
|
|
85
|
-
type
|
86
|
-
width
|
87
|
-
height
|
88
|
-
description
|
89
|
-
shape
|
90
|
-
anchor
|
86
|
+
type = drawing.type
|
87
|
+
width = drawing.width
|
88
|
+
height = drawing.height
|
89
|
+
description = drawing.description
|
90
|
+
shape = drawing.shape
|
91
|
+
anchor = drawing.anchor
|
92
|
+
rel_index = drawing.rel_index
|
93
|
+
url_rel_index = drawing.url_rel_index
|
94
|
+
tip = drawing.tip
|
95
|
+
|
91
96
|
col_from, row_from, col_from_offset, row_from_offset,
|
92
97
|
col_to, row_to, col_to_offset, row_to_offset, col_absolute, row_absolute = drawing.dimensions
|
93
98
|
|
@@ -113,10 +118,14 @@ def write_two_cell_anchor(*args)
|
|
113
118
|
# Graphic frame.
|
114
119
|
|
115
120
|
# Write the xdr:graphicFrame element for charts.
|
116
|
-
write_graphic_frame(index, description)
|
121
|
+
write_graphic_frame(index, rel_index, description)
|
117
122
|
elsif type == 2
|
118
123
|
# Write the xdr:pic element.
|
119
|
-
write_pic(
|
124
|
+
write_pic(
|
125
|
+
index, rel_index, col_absolute,
|
126
|
+
row_absolute, width, height,
|
127
|
+
description, url_rel_index , tip
|
128
|
+
)
|
120
129
|
else
|
121
130
|
# Write the xdr:sp element for shapes.
|
122
131
|
write_sp(index, col_absolute, row_absolute, width, height, shape)
|
@@ -149,7 +158,7 @@ def write_absolute_anchor(index)
|
|
149
158
|
end
|
150
159
|
|
151
160
|
# Write the xdr:graphicFrame element.
|
152
|
-
write_graphic_frame(index)
|
161
|
+
write_graphic_frame(index, index)
|
153
162
|
|
154
163
|
# Write the xdr:clientData element.
|
155
164
|
write_client_data
|
@@ -223,9 +232,9 @@ def write_row_off(data)
|
|
223
232
|
#
|
224
233
|
def write_pos(x, y)
|
225
234
|
attributes = [
|
226
|
-
|
227
|
-
|
228
|
-
|
235
|
+
['x', x],
|
236
|
+
['y', y]
|
237
|
+
]
|
229
238
|
|
230
239
|
@writer.empty_tag('xdr:pos', attributes)
|
231
240
|
end
|
@@ -235,9 +244,9 @@ def write_pos(x, y)
|
|
235
244
|
#
|
236
245
|
def write_ext(cx, cy)
|
237
246
|
attributes = [
|
238
|
-
|
239
|
-
|
240
|
-
|
247
|
+
['cx', cx],
|
248
|
+
['cy', cy]
|
249
|
+
]
|
241
250
|
|
242
251
|
@writer.empty_tag('xdr:ext', attributes)
|
243
252
|
end
|
@@ -245,7 +254,7 @@ def write_ext(cx, cy)
|
|
245
254
|
#
|
246
255
|
# Write the <xdr:graphicFrame> element.
|
247
256
|
#
|
248
|
-
def write_graphic_frame(index, name = nil)
|
257
|
+
def write_graphic_frame(index, rel_index, name = nil)
|
249
258
|
macro = ''
|
250
259
|
|
251
260
|
attributes = [ ['macro', macro] ]
|
@@ -256,7 +265,7 @@ def write_graphic_frame(index, name = nil)
|
|
256
265
|
# Write the xdr:xfrm element.
|
257
266
|
write_xfrm
|
258
267
|
# Write the a:graphic element.
|
259
|
-
write_atag_graphic(
|
268
|
+
write_atag_graphic(rel_index)
|
260
269
|
end
|
261
270
|
end
|
262
271
|
|
@@ -277,18 +286,42 @@ def write_nv_graphic_frame_pr(index, name = nil)
|
|
277
286
|
#
|
278
287
|
# Write the <xdr:cNvPr> element.
|
279
288
|
#
|
280
|
-
def write_c_nv_pr(
|
289
|
+
def write_c_nv_pr(index, name, description = nil, url_rel_index = nil, tip = nil)
|
281
290
|
attributes = [
|
282
|
-
|
283
|
-
|
291
|
+
['id', index],
|
292
|
+
['name', name]
|
284
293
|
]
|
285
294
|
|
286
295
|
# Add description attribute for images.
|
287
|
-
attributes << ['descr',
|
296
|
+
attributes << ['descr', description] if description
|
288
297
|
|
289
|
-
|
298
|
+
if ptrue?(url_rel_index)
|
299
|
+
@writer.tag_elements('xdr:cNvPr', attributes) do
|
300
|
+
# Write the a:hlinkClick element.
|
301
|
+
write_a_hlink_click(url_rel_index, tip)
|
302
|
+
end
|
303
|
+
else
|
304
|
+
@writer.empty_tag('xdr:cNvPr', attributes)
|
305
|
+
end
|
290
306
|
end
|
291
307
|
|
308
|
+
#
|
309
|
+
# Write the <a:hlinkClick> element.
|
310
|
+
#
|
311
|
+
def write_a_hlink_click(index, tip)
|
312
|
+
schema = 'http://schemas.openxmlformats.org/officeDocument/'
|
313
|
+
xmlns_r = "#{schema}2006/relationships"
|
314
|
+
r_id = "rId#{index}"
|
315
|
+
|
316
|
+
attributes = [
|
317
|
+
['xmlns:r', xmlns_r],
|
318
|
+
['r:id', r_id]
|
319
|
+
]
|
320
|
+
|
321
|
+
attributes << ['tooltip', tip] if tip
|
322
|
+
|
323
|
+
@writer.empty_tag('a:hlinkClick', attributes)
|
324
|
+
end
|
292
325
|
|
293
326
|
#
|
294
327
|
# Write the <xdr:cNvGraphicFramePr> element.
|
@@ -371,7 +404,7 @@ def write_atag_graphic(index)
|
|
371
404
|
# Write the <a:graphicData> element.
|
372
405
|
#
|
373
406
|
def write_atag_graphic_data(index)
|
374
|
-
uri
|
407
|
+
uri = 'http://schemas.openxmlformats.org/drawingml/2006/chart'
|
375
408
|
|
376
409
|
attributes = [ ['uri', uri] ]
|
377
410
|
|
@@ -494,12 +527,12 @@ def write_nv_sp_pr(index, shape)
|
|
494
527
|
#
|
495
528
|
# Write the <xdr:pic> element.
|
496
529
|
#
|
497
|
-
def write_pic(index, col_absolute, row_absolute, width, height, description)
|
530
|
+
def write_pic(index, rel_index, col_absolute, row_absolute, width, height, description, url_rel_index, tip)
|
498
531
|
@writer.tag_elements('xdr:pic') do
|
499
532
|
# Write the xdr:nvPicPr element.
|
500
|
-
write_nv_pic_pr(index, description)
|
533
|
+
write_nv_pic_pr(index, rel_index, description, url_rel_index, tip)
|
501
534
|
# Write the xdr:blipFill element.
|
502
|
-
write_blip_fill(
|
535
|
+
write_blip_fill(rel_index)
|
503
536
|
|
504
537
|
# Pictures are rectangle shapes by default.
|
505
538
|
shape = Shape.new
|
@@ -513,10 +546,13 @@ def write_pic(index, col_absolute, row_absolute, width, height, description)
|
|
513
546
|
#
|
514
547
|
# Write the <xdr:nvPicPr> element.
|
515
548
|
#
|
516
|
-
def write_nv_pic_pr(index, description)
|
549
|
+
def write_nv_pic_pr(index, rel_index, description, url_rel_index, tip)
|
517
550
|
@writer.tag_elements('xdr:nvPicPr') do
|
518
551
|
# Write the xdr:cNvPr element.
|
519
|
-
write_c_nv_pr(
|
552
|
+
write_c_nv_pr(
|
553
|
+
index + 1, "Picture #{index}", description,
|
554
|
+
url_rel_index, tip
|
555
|
+
)
|
520
556
|
# Write the xdr:cNvPicPr element.
|
521
557
|
write_c_nv_pic_pr
|
522
558
|
end
|
@@ -31,8 +31,8 @@ def assemble_xml_file
|
|
31
31
|
#
|
32
32
|
# Add container relationship to XLSX .rels xml files.
|
33
33
|
#
|
34
|
-
def add_document_relationship(type, target)
|
35
|
-
@rels.push([Document_schema + type, target])
|
34
|
+
def add_document_relationship(type, target, target_mode = nil)
|
35
|
+
@rels.push([Document_schema + type, target, target_mode])
|
36
36
|
end
|
37
37
|
|
38
38
|
#
|
data/lib/write_xlsx/utility.rb
CHANGED
@@ -218,6 +218,25 @@ def convert_date_time(date_time_string) #:nodoc:
|
|
218
218
|
end
|
219
219
|
end
|
220
220
|
|
221
|
+
def escape_url(url)
|
222
|
+
unless url =~ /%[0-9a-fA-F]{2}/
|
223
|
+
# Escape the URL escape symbol.
|
224
|
+
url = url.gsub(/%/, "%25")
|
225
|
+
|
226
|
+
# Escape whitespae in URL.
|
227
|
+
url = url.gsub(/[\s\x00]/, '%20')
|
228
|
+
|
229
|
+
# Escape other special characters in URL.
|
230
|
+
re = /(["<>\[\]`^{}])/
|
231
|
+
while re =~ url
|
232
|
+
match = $~[1]
|
233
|
+
url = url.sub(re, sprintf("%%%x", match.ord))
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
url
|
238
|
+
end
|
239
|
+
|
221
240
|
def absolute_char(absolute)
|
222
241
|
absolute ? '$' : ''
|
223
242
|
end
|
data/lib/write_xlsx/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
WriteXLSX_VERSION = "1.
|
1
|
+
WriteXLSX_VERSION = "1.02.0"
|
data/lib/write_xlsx/workbook.rb
CHANGED
@@ -49,6 +49,7 @@ class Workbook
|
|
49
49
|
attr_reader :shared_strings # :nodoc:
|
50
50
|
attr_reader :vba_project # :nodoc:
|
51
51
|
attr_reader :excel2003_style # :nodoc:
|
52
|
+
attr_reader :max_url_length # :nodoc:
|
52
53
|
attr_reader :strings_to_urls # :nodoc:
|
53
54
|
attr_reader :default_url_format # :nodoc:
|
54
55
|
|
@@ -130,6 +131,12 @@ def initialize(file, *option_params)
|
|
130
131
|
@images = []
|
131
132
|
@strings_to_urls = (options[:strings_to_urls].nil? || options[:strings_to_urls]) ? true : false
|
132
133
|
|
134
|
+
@max_url_length = 2079
|
135
|
+
if options[:max_url_length]
|
136
|
+
@max_url_length = options[:max_url_length]
|
137
|
+
|
138
|
+
@max_url_length = 2079 if @max_url_length < 250
|
139
|
+
end
|
133
140
|
# Structures for the shared strings data.
|
134
141
|
@shared_strings = Package::SharedStrings.new
|
135
142
|
|
@@ -1935,12 +1942,6 @@ def prepare_drawings #:nodoc:
|
|
1935
1942
|
has_drawings = true
|
1936
1943
|
end
|
1937
1944
|
|
1938
|
-
# Prepare the worksheet charts.
|
1939
|
-
sheet.charts.each_with_index do |chart, index|
|
1940
|
-
chart_ref_id += 1
|
1941
|
-
sheet.prepare_chart(index, chart_ref_id, drawing_id)
|
1942
|
-
end
|
1943
|
-
|
1944
1945
|
# Prepare the worksheet images.
|
1945
1946
|
sheet.images.each_with_index do |image, index|
|
1946
1947
|
type, width, height, name, x_dpi, y_dpi = get_image_properties(image[2])
|
@@ -1948,6 +1949,12 @@ def prepare_drawings #:nodoc:
|
|
1948
1949
|
sheet.prepare_image(index, image_ref_id, drawing_id, width, height, name, type, x_dpi, y_dpi)
|
1949
1950
|
end
|
1950
1951
|
|
1952
|
+
# Prepare the worksheet charts.
|
1953
|
+
sheet.charts.each_with_index do |chart, index|
|
1954
|
+
chart_ref_id += 1
|
1955
|
+
sheet.prepare_chart(index, chart_ref_id, drawing_id)
|
1956
|
+
end
|
1957
|
+
|
1951
1958
|
# Prepare the worksheet shapes.
|
1952
1959
|
sheet.shapes.each_with_index do |shape, index|
|
1953
1960
|
sheet.prepare_shape(index, drawing_id)
|
data/lib/write_xlsx/worksheet.rb
CHANGED
@@ -309,6 +309,7 @@ def initialize(workbook, index, name) #:nodoc:
|
|
309
309
|
@excel_version = 2007
|
310
310
|
@palette = workbook.palette
|
311
311
|
@default_url_format = workbook.default_url_format
|
312
|
+
@max_url_length = workbook.max_url_length
|
312
313
|
|
313
314
|
@page_setup = PageSetup.new
|
314
315
|
|
@@ -356,6 +357,8 @@ def initialize(workbook, index, name) #:nodoc:
|
|
356
357
|
@sparklines = []
|
357
358
|
@shapes = []
|
358
359
|
@shape_hash = {}
|
360
|
+
@drawing_rels = {}
|
361
|
+
@drawing_rels_id = 0
|
359
362
|
@header_images = []
|
360
363
|
@footer_images = []
|
361
364
|
|
@@ -3047,6 +3050,8 @@ def insert_image(*args)
|
|
3047
3050
|
x_scale = params[:x_scale]
|
3048
3051
|
y_scale = params[:y_scale]
|
3049
3052
|
anchor = params[:object_position]
|
3053
|
+
url = params[:url]
|
3054
|
+
tip = params[:tip]
|
3050
3055
|
else
|
3051
3056
|
x_offset, y_offset, x_scale, y_scale, anchor = options
|
3052
3057
|
end
|
@@ -3056,7 +3061,10 @@ def insert_image(*args)
|
|
3056
3061
|
y_scale ||= 1
|
3057
3062
|
anchor ||= 2
|
3058
3063
|
|
3059
|
-
@images << [
|
3064
|
+
@images << [
|
3065
|
+
row, col, image, x_offset, y_offset,
|
3066
|
+
x_scale, y_scale, url, tip, anchor
|
3067
|
+
]
|
3060
3068
|
end
|
3061
3069
|
|
3062
3070
|
#
|
@@ -5728,7 +5736,7 @@ def prepare_chart(index, chart_id, drawing_id) # :nodoc:
|
|
5728
5736
|
name = chart.name
|
5729
5737
|
|
5730
5738
|
# Create a Drawing object to use with worksheet unless one already exists.
|
5731
|
-
drawing = Drawing.new(drawing_type, dimensions, 0, 0, name, nil, anchor)
|
5739
|
+
drawing = Drawing.new(drawing_type, dimensions, 0, 0, name, nil, anchor, drawing_rel_index, 0, nil)
|
5732
5740
|
if !drawings?
|
5733
5741
|
@drawings = Drawings.new
|
5734
5742
|
@drawings.add_drawing_object(drawing)
|
@@ -6077,6 +6085,21 @@ def write_sparkline_groups
|
|
6077
6085
|
|
6078
6086
|
private
|
6079
6087
|
|
6088
|
+
#
|
6089
|
+
# Get the index used to address a drawing rel link.
|
6090
|
+
#
|
6091
|
+
def drawing_rel_index(target = nil)
|
6092
|
+
if !target
|
6093
|
+
# Undefined values for drawings like charts will always be unique.
|
6094
|
+
@drawing_rels_id += 1
|
6095
|
+
elsif ptrue?(@drawing_rels[target])
|
6096
|
+
@drawing_rels[target]
|
6097
|
+
else
|
6098
|
+
@drawing_rels_id += 1
|
6099
|
+
@drawing_rels[target] = @drawing_rels_id
|
6100
|
+
end
|
6101
|
+
end
|
6102
|
+
|
6080
6103
|
def hyperlinks_count
|
6081
6104
|
@hyperlinks.keys.inject(0) { |s, n| s += @hyperlinks[n].keys.size }
|
6082
6105
|
end
|
@@ -6429,7 +6452,8 @@ def prepare_image(index, image_id, drawing_id, width, height, name, image_type,
|
|
6429
6452
|
y_dpi ||= 96
|
6430
6453
|
drawing_type = 2
|
6431
6454
|
|
6432
|
-
row, col, image, x_offset, y_offset,
|
6455
|
+
row, col, image, x_offset, y_offset,
|
6456
|
+
x_scale, y_scale, url, tip, anchor = @images[index]
|
6433
6457
|
|
6434
6458
|
width *= x_scale
|
6435
6459
|
height *= y_scale
|
@@ -6444,7 +6468,7 @@ def prepare_image(index, image_id, drawing_id, width, height, name, image_type,
|
|
6444
6468
|
height = (0.5 + (height * 9_525)).to_i
|
6445
6469
|
|
6446
6470
|
# Create a Drawing object to use with worksheet unless one already exists.
|
6447
|
-
drawing = Drawing.new(drawing_type, dimensions, width, height, name, nil, anchor)
|
6471
|
+
drawing = Drawing.new(drawing_type, dimensions, width, height, name, nil, anchor, 0, 0, tip)
|
6448
6472
|
if !drawings?
|
6449
6473
|
drawings = Drawings.new
|
6450
6474
|
drawings.embedded = 1
|
@@ -6457,6 +6481,35 @@ def prepare_image(index, image_id, drawing_id, width, height, name, image_type,
|
|
6457
6481
|
end
|
6458
6482
|
drawings.add_drawing_object(drawing)
|
6459
6483
|
|
6484
|
+
if url
|
6485
|
+
rel_type = '/hyperlink'
|
6486
|
+
target_mode = 'External'
|
6487
|
+
if url =~ %r!^[fh]tt?ps?://! || url =~ /^mailto:/
|
6488
|
+
target = escape_url(url)
|
6489
|
+
end
|
6490
|
+
if url =~ /^external:/
|
6491
|
+
target = escape_url(url.sub(/^external:/, 'file:///'))
|
6492
|
+
# Additional escape not required in worksheet hyperlinks
|
6493
|
+
target = target.gsub(/#/, '%23')
|
6494
|
+
end
|
6495
|
+
if url =~ /^internal:/
|
6496
|
+
target = url.sub(/^internal:/, '#')
|
6497
|
+
target_mode = nil
|
6498
|
+
end
|
6499
|
+
|
6500
|
+
if target.length > 255
|
6501
|
+
raise <<"EOS"
|
6502
|
+
Ignoring URL #{target} where link or anchor > 255 characters since it exceeds Excel's limit for URLS. See LIMITATIONS section of the WriteXLSX documentation.
|
6503
|
+
EOS
|
6504
|
+
end
|
6505
|
+
|
6506
|
+
if target
|
6507
|
+
@drawing_links << [rel_type, target, target_mode]
|
6508
|
+
end
|
6509
|
+
drawing.url_rel_index = drawing_rel_index
|
6510
|
+
end
|
6511
|
+
|
6512
|
+
drawing.rel_index = drawing_rel_index
|
6460
6513
|
@drawing_links << ['/image', "../media/image#{image_id}.#{image_type}"]
|
6461
6514
|
end
|
6462
6515
|
public :prepare_image
|
@@ -6575,7 +6628,7 @@ def prepare_shape(index, drawing_id)
|
|
6575
6628
|
shape.calc_position_emus(self)
|
6576
6629
|
|
6577
6630
|
drawing_type = 3
|
6578
|
-
drawing = Drawing.new(drawing_type, shape.dimensions, shape.width_emu, shape.height_emu, shape.name, shape, shape.anchor)
|
6631
|
+
drawing = Drawing.new(drawing_type, shape.dimensions, shape.width_emu, shape.height_emu, shape.name, shape, shape.anchor, drawing_rel_index, 0, nil)
|
6579
6632
|
drawings.add_drawing_object(drawing)
|
6580
6633
|
end
|
6581
6634
|
public :prepare_shape
|
@@ -7,19 +7,19 @@ class Hyperlink # :nodoc:
|
|
7
7
|
|
8
8
|
attr_reader :str, :tip
|
9
9
|
|
10
|
-
MAXIMUM_URLS_SIZE =
|
10
|
+
MAXIMUM_URLS_SIZE = 2079
|
11
11
|
|
12
|
-
def self.factory(url, str = nil, tip = nil)
|
12
|
+
def self.factory(url, str = nil, tip = nil, max_url_length = MAXIMUM_URLS_SIZE)
|
13
13
|
if url =~ /^internal:(.+)/
|
14
|
-
InternalHyperlink.new($~[1], str, tip)
|
14
|
+
InternalHyperlink.new($~[1], str, tip, max_url_length)
|
15
15
|
elsif url =~ /^external:(.+)/
|
16
|
-
ExternalHyperlink.new($~[1], str, tip)
|
16
|
+
ExternalHyperlink.new($~[1], str, tip, max_url_length)
|
17
17
|
else
|
18
|
-
new(url, str, tip)
|
18
|
+
new(url, str, tip, max_url_length)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
def initialize(url, str, tip)
|
22
|
+
def initialize(url, str, tip, max_url_length)
|
23
23
|
# The displayed string defaults to the url string.
|
24
24
|
str ||= url.dup
|
25
25
|
|
@@ -33,8 +33,8 @@ def initialize(url, str, tip)
|
|
33
33
|
url = escape_url(url)
|
34
34
|
|
35
35
|
# Excel limits the escaped URL and location/anchor to 255 characters.
|
36
|
-
if url.bytesize >
|
37
|
-
raise "Ignoring URL '#{url}' where link or anchor >
|
36
|
+
if url.bytesize > max_url_length || (!@url_str.nil? && @url_str.bytesize > max_url_length)
|
37
|
+
raise "Ignoring URL '#{url}' where link or anchor > #{max_url_length} characters since it exceeds Excel's limit for URLS. See LIMITATIONS section of the Excel::Writer::XLSX documentation."
|
38
38
|
end
|
39
39
|
|
40
40
|
@url = url
|
@@ -61,33 +61,12 @@ def external_hyper_link
|
|
61
61
|
def display_on
|
62
62
|
@display = @url_str
|
63
63
|
end
|
64
|
-
|
65
|
-
private
|
66
|
-
|
67
|
-
def escape_url(url)
|
68
|
-
unless url =~ /%[0-9a-fA-F]{2}/
|
69
|
-
# Escape the URL escape symbol.
|
70
|
-
url = url.gsub(/%/, "%25")
|
71
|
-
|
72
|
-
# Escape whitespae in URL.
|
73
|
-
url = url.gsub(/[\s\x00]/, '%20')
|
74
|
-
|
75
|
-
# Escape other special characters in URL.
|
76
|
-
re = /(["<>\[\]`^{}])/
|
77
|
-
while re =~ url
|
78
|
-
match = $~[1]
|
79
|
-
url = url.sub(re, sprintf("%%%x", match.ord))
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
url
|
84
|
-
end
|
85
64
|
end
|
86
65
|
|
87
66
|
class InternalHyperlink < Hyperlink
|
88
67
|
undef external_hyper_link
|
89
68
|
|
90
|
-
def initialize(url, str, tip)
|
69
|
+
def initialize(url, str, tip, max_url_length)
|
91
70
|
@url = url
|
92
71
|
# The displayed string defaults to the url string.
|
93
72
|
str ||= @url.dup
|
@@ -98,9 +77,9 @@ def initialize(url, str, tip)
|
|
98
77
|
# Copy string for use in hyperlink elements.
|
99
78
|
@url_str = @str.dup
|
100
79
|
|
101
|
-
# Excel limits escaped URL to
|
102
|
-
if @url.bytesize >
|
103
|
-
raise "URL '#{@url}' > #{
|
80
|
+
# Excel limits escaped URL to #{max_url_length} characters.
|
81
|
+
if @url.bytesize > max_url_length
|
82
|
+
raise "URL '#{@url}' > #{max_url_length} characters, it exceeds Excel's limit for URLS."
|
104
83
|
end
|
105
84
|
|
106
85
|
@tip = tip
|
@@ -118,7 +97,7 @@ def attributes(row, col, dummy = nil)
|
|
118
97
|
end
|
119
98
|
|
120
99
|
class ExternalHyperlink < Hyperlink
|
121
|
-
def initialize(url, str, tip)
|
100
|
+
def initialize(url, str, tip, max_url_length)
|
122
101
|
# The displayed string defaults to the url string.
|
123
102
|
str ||= url.dup
|
124
103
|
|
@@ -145,9 +124,9 @@ def initialize(url, str, tip)
|
|
145
124
|
url = url.sub(%r!^.\\!, '')
|
146
125
|
@url_str = url_str
|
147
126
|
|
148
|
-
# Excel limits the escaped URL and location/anchor to
|
149
|
-
if url.bytesize >
|
150
|
-
raise "Ignoring URL '#{url}' where link or anchor >
|
127
|
+
# Excel limits the escaped URL and location/anchor to max_url_length characters.
|
128
|
+
if url.bytesize > max_url_length || (!@url_str.nil? && @url_str.bytesize > max_url_length)
|
129
|
+
raise "Ignoring URL '#{url}' where link or anchor > #{max_url_length} characters since it exceeds Excel's limit for URLS. See LIMITATIONS section of the Excel::Writer::XLSX documentation."
|
151
130
|
end
|
152
131
|
|
153
132
|
@url = url
|
@@ -7,7 +7,7 @@ def test_drawing_chart_01
|
|
7
7
|
@obj = Writexlsx::Drawings.new
|
8
8
|
dimensions = [4, 8, 457200, 104775, 12, 22, 152400, 180975]
|
9
9
|
drawing = Writexlsx::Drawing.new(
|
10
|
-
1, dimensions, nil, nil, nil, nil, 1
|
10
|
+
1, dimensions, nil, nil, nil, nil, 1, 1
|
11
11
|
)
|
12
12
|
@obj.add_drawing_object(drawing)
|
13
13
|
@obj.embedded = true
|
@@ -9,7 +9,7 @@ def test_drawing_image_01
|
|
9
9
|
2, 1, 0, 0, 3, 6, 533257, 190357, 1219200, 190500
|
10
10
|
]
|
11
11
|
drawing = Writexlsx::Drawing.new(
|
12
|
-
2, dimensions, 1142857, 1142857, 'republic.png', nil, 2
|
12
|
+
2, dimensions, 1142857, 1142857, 'republic.png', nil, 2, 1
|
13
13
|
)
|
14
14
|
@obj.add_drawing_object(drawing)
|
15
15
|
# @obj.add_drawing_object(
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionHyperlink32 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true) if @tempfile
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_hyperlink32
|
14
|
+
@xlsx = 'hyperlink32.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image(
|
19
|
+
'E9', 'test/regression/images/red.png',
|
20
|
+
:url => 'https://github.com/jmcnamara'
|
21
|
+
)
|
22
|
+
|
23
|
+
workbook.close
|
24
|
+
|
25
|
+
compare_for_regression
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionHyperlink33 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true) if @tempfile
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_hyperlink33
|
14
|
+
@xlsx = 'hyperlink33.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image(
|
19
|
+
'E9', 'test/regression/images/red.png',
|
20
|
+
:url => 'https://github.com/jmcnamara',
|
21
|
+
:tip => 'GitHub'
|
22
|
+
)
|
23
|
+
|
24
|
+
workbook.close
|
25
|
+
|
26
|
+
compare_for_regression
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionHyperlink34 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true) if @tempfile
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_hyperlink34
|
14
|
+
@xlsx = 'hyperlink34.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image('A1', 'test/regression/images/blue.png')
|
19
|
+
worksheet.insert_image(
|
20
|
+
'B3', 'test/regression/images/red.jpg',
|
21
|
+
:url => 'https://github.com/jmcnamara'
|
22
|
+
)
|
23
|
+
worksheet.insert_image('D5', 'test/regression/images/yellow.jpg')
|
24
|
+
worksheet.insert_image(
|
25
|
+
'F9', 'test/regression/images/grey.png',
|
26
|
+
:url => 'https://github.com'
|
27
|
+
)
|
28
|
+
|
29
|
+
workbook.close
|
30
|
+
|
31
|
+
compare_for_regression
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionHyperlink35 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true) if @tempfile
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_hyperlink35
|
14
|
+
@xlsx = 'hyperlink35.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image(
|
19
|
+
'A1', 'test/regression/images/blue.png',
|
20
|
+
:url => 'https://github.com/foo'
|
21
|
+
)
|
22
|
+
worksheet.insert_image(
|
23
|
+
'B3', 'test/regression/images/red.jpg',
|
24
|
+
:url => 'https://github.com/bar'
|
25
|
+
)
|
26
|
+
worksheet.insert_image(
|
27
|
+
'D5', 'test/regression/images/yellow.jpg',
|
28
|
+
:url => 'https://github.com/baz'
|
29
|
+
)
|
30
|
+
worksheet.insert_image(
|
31
|
+
'F9', 'test/regression/images/grey.png',
|
32
|
+
:url => 'https://github.com/boo'
|
33
|
+
)
|
34
|
+
|
35
|
+
workbook.close
|
36
|
+
|
37
|
+
compare_for_regression
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionHyperlink36 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true) if @tempfile
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_hyperlink36
|
14
|
+
@xlsx = 'hyperlink36.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'pie', :embedded => 1)
|
18
|
+
|
19
|
+
worksheet.write('A1', 1)
|
20
|
+
worksheet.write('A2', 2)
|
21
|
+
|
22
|
+
worksheet.insert_image(
|
23
|
+
'E9', 'test/regression/images/red.png',
|
24
|
+
:url => 'https://github.com/jmcnamara'
|
25
|
+
)
|
26
|
+
|
27
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$2')
|
28
|
+
worksheet.insert_chart('E12', chart)
|
29
|
+
|
30
|
+
workbook.close
|
31
|
+
|
32
|
+
compare_for_regression
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionHyperlink37 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true) if @tempfile
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_hyperlink37
|
14
|
+
@xlsx = 'hyperlink37.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
textbox = workbook.add_shape
|
19
|
+
|
20
|
+
worksheet.insert_image(
|
21
|
+
'E9', 'test/regression/images/red.png',
|
22
|
+
:url => 'https://github.com/jmcnamara'
|
23
|
+
)
|
24
|
+
|
25
|
+
worksheet.insert_shape('E12', textbox)
|
26
|
+
|
27
|
+
workbook.close
|
28
|
+
|
29
|
+
compare_for_regression(
|
30
|
+
['xl/drawings/drawing1.xml'], {}
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionHyperlink38 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true) if @tempfile
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_hyperlink38
|
14
|
+
@xlsx = 'hyperlink38.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image(
|
19
|
+
'E9', 'test/regression/images/red.png',
|
20
|
+
:url => 'internal:Sheet1!A1'
|
21
|
+
)
|
22
|
+
|
23
|
+
workbook.close
|
24
|
+
|
25
|
+
compare_for_regression
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionHyperlink39 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true) if @tempfile
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_hyperlink39
|
14
|
+
@xlsx = 'hyperlink39.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image(
|
19
|
+
'E9', 'test/regression/images/red.png',
|
20
|
+
:url => 'external:c:\temp\foo.xlsx'
|
21
|
+
)
|
22
|
+
|
23
|
+
workbook.close
|
24
|
+
|
25
|
+
compare_for_regression
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionHyperlink40 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true) if @tempfile
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_hyperlink40
|
14
|
+
@xlsx = 'hyperlink40.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image(
|
19
|
+
'E9', 'test/regression/images/red.png',
|
20
|
+
:url => 'https://github.com/jmcnamara#foo'
|
21
|
+
)
|
22
|
+
|
23
|
+
workbook.close
|
24
|
+
|
25
|
+
compare_for_regression
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionHyperlink41 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true) if @tempfile
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_hyperlink41
|
14
|
+
@xlsx = 'hyperlink41.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image(
|
19
|
+
'E9', 'test/regression/images/red.png',
|
20
|
+
:url => 'https://github.com/jmcnamara<foo>'
|
21
|
+
)
|
22
|
+
|
23
|
+
workbook.close
|
24
|
+
|
25
|
+
compare_for_regression
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionHyperlink42 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true) if @tempfile
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_hyperlink42
|
14
|
+
@xlsx = 'hyperlink42.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image(
|
19
|
+
'E9', 'test/regression/images/red.png',
|
20
|
+
:url => 'mailto:jmcnamara@cpan.org'
|
21
|
+
)
|
22
|
+
|
23
|
+
workbook.close
|
24
|
+
|
25
|
+
compare_for_regression
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionHyperlink43 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true) if @tempfile
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_hyperlink43
|
14
|
+
@xlsx = 'hyperlink43.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image(
|
19
|
+
'E9', 'test/regression/images/red.png',
|
20
|
+
:url => 'external:c:\te mp\foo.xlsx'
|
21
|
+
)
|
22
|
+
|
23
|
+
workbook.close
|
24
|
+
|
25
|
+
compare_for_regression
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionHyperlink44 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true) if @tempfile
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_hyperlink44
|
14
|
+
@xlsx = 'hyperlink44.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet('Sheet 1')
|
17
|
+
|
18
|
+
worksheet.insert_image(
|
19
|
+
'E9', 'test/regression/images/red.png',
|
20
|
+
:url => "internal:'Sheet 1'!A1"
|
21
|
+
)
|
22
|
+
|
23
|
+
workbook.close
|
24
|
+
|
25
|
+
compare_for_regression
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionHyperlink45 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true) if @tempfile
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_hyperlink45
|
14
|
+
@xlsx = 'hyperlink45.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image(
|
19
|
+
'E9', 'test/regression/images/red.png',
|
20
|
+
:url => %q(external:\\\\Vboxsvr\share\foo bar.xlsx#'Some Sheet'!A1)
|
21
|
+
)
|
22
|
+
|
23
|
+
workbook.close
|
24
|
+
|
25
|
+
compare_for_regression
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionHyperlink47 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true) if @tempfile
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_hyperlink47
|
14
|
+
@xlsx = 'hyperlink47.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.write_url(
|
19
|
+
'A1',
|
20
|
+
'http://foo.com/this_is_a_long_hyperlink_that_exceeds_a_limit_of_255_characters_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
|
21
|
+
)
|
22
|
+
|
23
|
+
workbook.close
|
24
|
+
|
25
|
+
compare_for_regression
|
26
|
+
end
|
27
|
+
end
|
@@ -17,13 +17,13 @@ def test_image06
|
|
17
17
|
chart = workbook.add_chart(:type => 'bar', :embedded => 1)
|
18
18
|
|
19
19
|
# For testig, copy the randomly generated axis ids in the target xlsx file.
|
20
|
-
chart.instance_variable_set(:@axis_ids, [
|
20
|
+
chart.instance_variable_set(:@axis_ids, [87089152, 87093632])
|
21
21
|
|
22
22
|
data = [
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
[1, 2, 3, 4, 5],
|
24
|
+
[2, 4, 6, 8, 10],
|
25
|
+
[3, 6, 9, 12, 15]
|
26
|
+
]
|
27
27
|
|
28
28
|
worksheet.write('A1', data)
|
29
29
|
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
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: 1.
|
4
|
+
version: 1.02.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hideo NAKAMURA
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -900,6 +900,21 @@ files:
|
|
900
900
|
- test/regression/test_hyperlink28.rb
|
901
901
|
- test/regression/test_hyperlink29.rb
|
902
902
|
- test/regression/test_hyperlink30.rb
|
903
|
+
- test/regression/test_hyperlink32.rb
|
904
|
+
- test/regression/test_hyperlink33.rb
|
905
|
+
- test/regression/test_hyperlink34.rb
|
906
|
+
- test/regression/test_hyperlink35.rb
|
907
|
+
- test/regression/test_hyperlink36.rb
|
908
|
+
- test/regression/test_hyperlink37.rb
|
909
|
+
- test/regression/test_hyperlink38.rb
|
910
|
+
- test/regression/test_hyperlink39.rb
|
911
|
+
- test/regression/test_hyperlink40.rb
|
912
|
+
- test/regression/test_hyperlink41.rb
|
913
|
+
- test/regression/test_hyperlink42.rb
|
914
|
+
- test/regression/test_hyperlink43.rb
|
915
|
+
- test/regression/test_hyperlink44.rb
|
916
|
+
- test/regression/test_hyperlink45.rb
|
917
|
+
- test/regression/test_hyperlink47.rb
|
903
918
|
- test/regression/test_image01.rb
|
904
919
|
- test/regression/test_image02.rb
|
905
920
|
- test/regression/test_image03.rb
|
@@ -1585,6 +1600,23 @@ files:
|
|
1585
1600
|
- test/regression/xlsx_files/hyperlink29.xlsx
|
1586
1601
|
- test/regression/xlsx_files/hyperlink30.xlsx
|
1587
1602
|
- test/regression/xlsx_files/hyperlink31.xlsx
|
1603
|
+
- test/regression/xlsx_files/hyperlink32.xlsx
|
1604
|
+
- test/regression/xlsx_files/hyperlink33.xlsx
|
1605
|
+
- test/regression/xlsx_files/hyperlink34.xlsx
|
1606
|
+
- test/regression/xlsx_files/hyperlink35.xlsx
|
1607
|
+
- test/regression/xlsx_files/hyperlink36.xlsx
|
1608
|
+
- test/regression/xlsx_files/hyperlink37.xlsx
|
1609
|
+
- test/regression/xlsx_files/hyperlink38.xlsx
|
1610
|
+
- test/regression/xlsx_files/hyperlink39.xlsx
|
1611
|
+
- test/regression/xlsx_files/hyperlink40.xlsx
|
1612
|
+
- test/regression/xlsx_files/hyperlink41.xlsx
|
1613
|
+
- test/regression/xlsx_files/hyperlink42.xlsx
|
1614
|
+
- test/regression/xlsx_files/hyperlink43.xlsx
|
1615
|
+
- test/regression/xlsx_files/hyperlink44.xlsx
|
1616
|
+
- test/regression/xlsx_files/hyperlink45.xlsx
|
1617
|
+
- test/regression/xlsx_files/hyperlink47.xlsx
|
1618
|
+
- test/regression/xlsx_files/hyperlink48.xlsx
|
1619
|
+
- test/regression/xlsx_files/hyperlink49.xlsx
|
1588
1620
|
- test/regression/xlsx_files/image01.xlsx
|
1589
1621
|
- test/regression/xlsx_files/image02.xlsx
|
1590
1622
|
- test/regression/xlsx_files/image03.xlsx
|
@@ -1925,7 +1957,7 @@ homepage: https://github.com/cxn03651/write_xlsx#readme
|
|
1925
1957
|
licenses:
|
1926
1958
|
- MIT
|
1927
1959
|
metadata: {}
|
1928
|
-
post_install_message:
|
1960
|
+
post_install_message:
|
1929
1961
|
rdoc_options: []
|
1930
1962
|
require_paths:
|
1931
1963
|
- lib
|
@@ -1940,8 +1972,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1940
1972
|
- !ruby/object:Gem::Version
|
1941
1973
|
version: '0'
|
1942
1974
|
requirements: []
|
1943
|
-
rubygems_version: 3.
|
1944
|
-
signing_key:
|
1975
|
+
rubygems_version: 3.1.4
|
1976
|
+
signing_key:
|
1945
1977
|
specification_version: 4
|
1946
1978
|
summary: write_xlsx is a gem to create a new file in the Excel 2007+ XLSX format.
|
1947
1979
|
test_files:
|
@@ -2638,6 +2670,21 @@ test_files:
|
|
2638
2670
|
- test/regression/test_hyperlink28.rb
|
2639
2671
|
- test/regression/test_hyperlink29.rb
|
2640
2672
|
- test/regression/test_hyperlink30.rb
|
2673
|
+
- test/regression/test_hyperlink32.rb
|
2674
|
+
- test/regression/test_hyperlink33.rb
|
2675
|
+
- test/regression/test_hyperlink34.rb
|
2676
|
+
- test/regression/test_hyperlink35.rb
|
2677
|
+
- test/regression/test_hyperlink36.rb
|
2678
|
+
- test/regression/test_hyperlink37.rb
|
2679
|
+
- test/regression/test_hyperlink38.rb
|
2680
|
+
- test/regression/test_hyperlink39.rb
|
2681
|
+
- test/regression/test_hyperlink40.rb
|
2682
|
+
- test/regression/test_hyperlink41.rb
|
2683
|
+
- test/regression/test_hyperlink42.rb
|
2684
|
+
- test/regression/test_hyperlink43.rb
|
2685
|
+
- test/regression/test_hyperlink44.rb
|
2686
|
+
- test/regression/test_hyperlink45.rb
|
2687
|
+
- test/regression/test_hyperlink47.rb
|
2641
2688
|
- test/regression/test_image01.rb
|
2642
2689
|
- test/regression/test_image02.rb
|
2643
2690
|
- test/regression/test_image03.rb
|
@@ -3323,6 +3370,23 @@ test_files:
|
|
3323
3370
|
- test/regression/xlsx_files/hyperlink29.xlsx
|
3324
3371
|
- test/regression/xlsx_files/hyperlink30.xlsx
|
3325
3372
|
- test/regression/xlsx_files/hyperlink31.xlsx
|
3373
|
+
- test/regression/xlsx_files/hyperlink32.xlsx
|
3374
|
+
- test/regression/xlsx_files/hyperlink33.xlsx
|
3375
|
+
- test/regression/xlsx_files/hyperlink34.xlsx
|
3376
|
+
- test/regression/xlsx_files/hyperlink35.xlsx
|
3377
|
+
- test/regression/xlsx_files/hyperlink36.xlsx
|
3378
|
+
- test/regression/xlsx_files/hyperlink37.xlsx
|
3379
|
+
- test/regression/xlsx_files/hyperlink38.xlsx
|
3380
|
+
- test/regression/xlsx_files/hyperlink39.xlsx
|
3381
|
+
- test/regression/xlsx_files/hyperlink40.xlsx
|
3382
|
+
- test/regression/xlsx_files/hyperlink41.xlsx
|
3383
|
+
- test/regression/xlsx_files/hyperlink42.xlsx
|
3384
|
+
- test/regression/xlsx_files/hyperlink43.xlsx
|
3385
|
+
- test/regression/xlsx_files/hyperlink44.xlsx
|
3386
|
+
- test/regression/xlsx_files/hyperlink45.xlsx
|
3387
|
+
- test/regression/xlsx_files/hyperlink47.xlsx
|
3388
|
+
- test/regression/xlsx_files/hyperlink48.xlsx
|
3389
|
+
- test/regression/xlsx_files/hyperlink49.xlsx
|
3326
3390
|
- test/regression/xlsx_files/image01.xlsx
|
3327
3391
|
- test/regression/xlsx_files/image02.xlsx
|
3328
3392
|
- test/regression/xlsx_files/image03.xlsx
|