fast_excel 0.2.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c5919483e8d5ac1277efefe8399926f14b45d10
4
- data.tar.gz: 2a8bd5f6067c8903778f3f7227f90d4c95d31868
3
+ metadata.gz: ac39efd3391a98291ae2c1f5ba4102850b8ad678
4
+ data.tar.gz: 7d2eb11896d20f80f20405778b009e09ac1b41ea
5
5
  SHA512:
6
- metadata.gz: dd0f959fe4eb08bd7506f63b4f666c3d47c05765aa8213c775f873264dd561e8aa2c9dd7f61d1ea5f1e6498199248dfef80bb9b5f7693025ec0c3f192671dd27
7
- data.tar.gz: 5168323f914545536e1f36ed30aa0f689a98e92a93875abb7137109c20c2adfbd78b905a6cf6339c36e9ae391c23d7461e24a6d15ad92cc28e43ef955b16ce1c
6
+ metadata.gz: ae26296476e89298ff1d584ae59e87e81f46a118e0c7583f5328fb12845afe970e1fe040c8783388e541d3b4077948957cec5923cd124d325475629e5272c495
7
+ data.tar.gz: 921ca060bf7cb21c541dc0664767a13d5f95be2f76d7947c24e2677133c06cc21d558f925e372b4d49f4fc56977650a13c876883e3b0f3850ba2f4953ab565a5
data/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ #### Version 0.2.1 - 20 jun 2017
2
+
3
+ * Add FastExcel::Formula
4
+
5
+ #### Version 0.2.0 - 24 apr 2017
6
+
7
+ * Add FastExcel.date_num
8
+ * Add feature to use user default font
9
+ * Add benchmarks
10
+
11
+ #### Version 0.1.0 - 24 feb 2017
12
+
13
+ Initial
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Ultra Fast Excel Writter for Ruby
2
2
 
3
3
  ```ruby
4
+ require 'fast_excel'
5
+
4
6
  workbook = FastExcel.open("hello_world_ffi.xlsx", constant_memory: true)
5
7
  workbook.default_format.set(
6
8
  font_size: 0, # user's default
@@ -24,6 +26,8 @@ for i in 1..1000
24
26
  worksheet.write_row(i, ["Hello", (rand * 10_000_000).round(2), Time.now])
25
27
  end
26
28
 
29
+ worksheet.write_row(1001, ["Sum", FastExcel::Formula.new("SUM(B2:B1001)")], bold)
30
+
27
31
  workbook.close
28
32
  ```
29
33
 
@@ -35,7 +39,7 @@ This repositiry and gem contain sources of [libxlsxwriter](https://github.com/jm
35
39
  ```
36
40
  Comparison:
37
41
  FastExcel: 31.7 i/s
38
- Axslx: 8.0 i/s - 3.98x slower
42
+ Axlsx: 8.0 i/s - 3.98x slower
39
43
  write_xlsx: 6.9 i/s - 4.62x slower
40
44
  ```
41
45
 
@@ -43,15 +47,15 @@ Comparison:
43
47
  ```
44
48
  Comparison:
45
49
  FastExcel: 1.4 i/s
46
- Axslx: 0.4 i/s - 3.46x slower
50
+ Axlsx: 0.4 i/s - 3.46x slower
47
51
  write_xlsx: 0.1 i/s - 17.04x slower
48
52
  ```
49
53
 
50
54
  Max memory usage, generating 100k rows:
51
55
  ```
52
56
  FastExcel - 20 MB
53
- Axslx - 60 MB
54
- write_axslx - 100 MB
57
+ Axlsx - 60 MB
58
+ write_xlsx - 100 MB
55
59
  ```
56
60
 
57
61
  ## Install
@@ -21,8 +21,8 @@ Benchmark.ips do |x|
21
21
  workbook.read_string
22
22
  end
23
23
 
24
- x.report("Axslx") do
25
- filename = "#{Dir.mktmpdir}/axslx.xslx"
24
+ x.report("Axlsx") do
25
+ filename = "#{Dir.mktmpdir}/axlsx.xlsx"
26
26
  Axlsx::Package.new do |package|
27
27
  package.use_autowidth = false
28
28
  package.workbook.add_worksheet do |sheet|
@@ -38,7 +38,7 @@ Benchmark.ips do |x|
38
38
  end
39
39
 
40
40
  x.report("write_xlsx") do
41
- filename = "#{Dir.mktmpdir}/write_xlsx.xslx"
41
+ filename = "#{Dir.mktmpdir}/write_xlsx.xlsx"
42
42
  workbook = WriteXLSX.new(filename)
43
43
  worksheet = workbook.add_worksheet
44
44
  HEADERS.each_with_index do |value, i|
@@ -14,8 +14,8 @@ Benchmark.ips do |x|
14
14
  write_fast_excel_20k
15
15
  end
16
16
 
17
- x.report("Axslx") do
18
- write_axslx_20k
17
+ x.report("Axlsx") do
18
+ write_axlsx_20k
19
19
  end
20
20
 
21
21
  x.report("write_xlsx") do
data/benchmarks/init.rb CHANGED
@@ -24,7 +24,7 @@ def write_fast_excel_20k
24
24
  end
25
25
 
26
26
  def write_xlsx_20k
27
- filename = "#{Dir.mktmpdir}/write_xlsx.xslx"
27
+ filename = "#{Dir.mktmpdir}/write_xlsx.xlsx"
28
28
  workbook = WriteXLSX.new(filename)
29
29
  worksheet = workbook.add_worksheet
30
30
  HEADERS.each_with_index do |value, i|
@@ -42,8 +42,8 @@ def write_xlsx_20k
42
42
  File.delete(filename)
43
43
  end
44
44
 
45
- def write_axslx_20k
46
- filename = "#{Dir.mktmpdir}/axslx.xslx"
45
+ def write_axlsx_20k
46
+ filename = "#{Dir.mktmpdir}/axlsx.xlsx"
47
47
  Axlsx::Package.new do |package|
48
48
  package.use_autowidth = false
49
49
  package.workbook.add_worksheet do |sheet|
data/benchmarks/memory.rb CHANGED
@@ -9,11 +9,11 @@ end
9
9
 
10
10
  puts "warm up..."
11
11
  write_fast_excel_20k
12
- write_axslx_20k
12
+ write_axlsx_20k
13
13
  write_xlsx_20k
14
14
 
15
15
  DATA.clear
16
- 100_000.times do |n|
16
+ 50_000.times do |n|
17
17
  DATA << [n, "String string #{n}" * 5, (n * rand * 10).round, Time.at(n * 1000 + 1492922688), n * 100]
18
18
  end
19
19
 
@@ -37,13 +37,13 @@ end
37
37
  GC.start
38
38
  sleep 5
39
39
 
40
- measure_memory("Axslx") do
41
- write_axslx_20k
40
+ measure_memory("Axlsx") do
41
+ write_axlsx_20k
42
42
  end
43
43
 
44
44
  GC.start
45
45
  sleep 5
46
46
 
47
- measure_memory("write_axslx") do
48
- write_axslx_20k
47
+ measure_memory("write_xlsx") do
48
+ write_xlsx_20k
49
49
  end
data/examples/example.rb CHANGED
@@ -1,7 +1,7 @@
1
- require_relative './lib/fast_excel'
1
+ require_relative '../lib/fast_excel'
2
2
  require 'pp'
3
3
 
4
- workbook = FastExcel.open("ffi_example.xlsx", constant_memory: true)
4
+ workbook = FastExcel.open("example.xlsx", constant_memory: true)
5
5
 
6
6
  workbook.default_format.set(
7
7
  font_size: 0, # user's default
@@ -39,4 +39,5 @@ for i in 1..1000
39
39
  # worksheet.write_datetime(i, 2, date, nil)
40
40
  end
41
41
 
42
- workbook.close
42
+ workbook.close
43
+ puts "Saved to file example.xlsx"
@@ -1,6 +1,6 @@
1
- require_relative './lib/fast_excel'
1
+ require_relative '../lib/fast_excel'
2
2
 
3
- workbook = FastExcel.open("chart_ffi.xlsx", constant_memory: true)
3
+ workbook = FastExcel.open("example_chart.xlsx", constant_memory: true)
4
4
  worksheet = workbook.add_worksheet
5
5
 
6
6
  for i in 0..5
@@ -18,3 +18,4 @@ chart.add_series("Montgomery", "Sheet1!$C$1:$C$5")
18
18
  worksheet.insert_chart(1, 7, chart)
19
19
 
20
20
  workbook.close
21
+ puts "Saved to file example_chart.xlsx"
@@ -0,0 +1,20 @@
1
+ require_relative '../lib/fast_excel'
2
+ require 'pp'
3
+ require 'looksee'
4
+
5
+ workbook = FastExcel.open("example_formula.xlsx", constant_memory: false)
6
+
7
+ worksheet = workbook.add_worksheet
8
+
9
+ worksheet.write_row(0, ["Item", "Weight"])
10
+ worksheet.write_row(1, ["Laptop", 1.37])
11
+ worksheet.write_row(2, ["Phone", 0.138])
12
+ worksheet.write_row(3, ["Mouse", 0.099])
13
+ worksheet.write_row(4, ["Speaker", 2.5])
14
+ worksheet.write_row(5, ["Camera", 0.383])
15
+ worksheet.write_row(6, ["Total", FastExcel::Formula.new("SUM(B2:B6)")], workbook.bold_cell_format)
16
+
17
+ bold = workbook.bold_cell_format
18
+
19
+ workbook.close
20
+ puts "Saved to file example_formula.xlsx"
@@ -1,6 +1,6 @@
1
- require_relative './lib/fast_excel'
1
+ require_relative '../lib/fast_excel'
2
2
 
3
- workbook = FastExcel.open("ffi_example_image.xlsx", constant_memory: false)
3
+ workbook = FastExcel.open("example_image.xlsx", constant_memory: false)
4
4
  worksheet = workbook.add_worksheet
5
5
 
6
6
  img_options = Libxlsxwriter::ImageOptions.new
@@ -10,3 +10,4 @@ img_options[:y_offset] = 0
10
10
  worksheet.insert_image_opt(3, 3, "libxlsxwriter/examples/logo.png", img_options)
11
11
 
12
12
  workbook.close
13
+ puts "Saved to file example_image.xlsx"
data/fast_excel.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "fast_excel"
3
- s.version = "0.2.0"
3
+ s.version = "0.2.1"
4
4
  s.author = ["Pavel Evstigneev"]
5
5
  s.email = ["pavel.evst@gmail.com"]
6
6
  s.homepage = "https://github.com/paxa/fast_excel"
data/lib/fast_excel.rb CHANGED
@@ -1,13 +1,21 @@
1
1
  require_relative './fast_excel/binding'
2
2
 
3
3
  module FastExcel
4
+
5
+ class Formula
6
+ attr_accessor :fml
7
+ def initialize(fml)
8
+ @fml = fml
9
+ end
10
+ end
11
+
4
12
  DEF_COL_WIDTH = 8.43
5
13
 
6
14
  def self.open(filename = nil, constant_memory: false, default_format: nil)
7
15
  tmp_file = false
8
16
  unless filename
9
17
  require 'tmpdir'
10
- filename = "#{Dir.mktmpdir}/fast_excel.xslx"
18
+ filename = "#{Dir.mktmpdir}/fast_excel.xlsx"
11
19
  tmp_file = true
12
20
  end
13
21
 
@@ -86,17 +94,20 @@ module FastExcel
86
94
  def self.print_ffi_obj(value)
87
95
  puts "#{value.class}"
88
96
  value.members.each do |key|
89
- field_val = if value[key].is_a?(FFI::Pointer) && value[key].null?
97
+ field_val = if value[key].is_a?(FFI::Pointer) && value[key].null? || value[key].nil?
90
98
  "nil"
91
99
  elsif value[key].is_a?(FFI::StructLayout::CharArray)
92
100
  value[key].to_str.inspect
93
101
  elsif value[key].is_a?(String)
94
102
  value[key].inspect
103
+ elsif value[key].is_a?(Symbol)
104
+ value[key].inspect
95
105
  else
96
106
  value[key]
97
107
  end
98
108
  puts "* #{key}: #{field_val}"
99
109
  end
110
+ nil
100
111
  end
101
112
 
102
113
  module AttributeHelper
@@ -110,12 +121,17 @@ module FastExcel
110
121
  end
111
122
  end
112
123
 
113
- def pretty_print(pp)
124
+ def fields_hash
114
125
  res = {}
115
126
  members.each do |key|
127
+ #p [key, self[key]]
116
128
  res[key] = respond_to?(key) ? send(key) : self[key]
117
129
  end
118
- pp res
130
+ res
131
+ end
132
+
133
+ def pretty_print(pp)
134
+ pp fields_hash
119
135
  end
120
136
  end
121
137
 
@@ -180,6 +196,8 @@ module FastExcel
180
196
  write_datetime(row_number, index, FastExcel.lxw_datetime(value), format)
181
197
  elsif value.is_a?(Time)
182
198
  write_datetime(row_number, index, FastExcel.lxw_time(value), format)
199
+ elsif value.is_a?(Formula)
200
+ write_formula(row_number, index, value.fml, format)
183
201
  else
184
202
  write_string(row_number, index, value.to_s, format)
185
203
  end
@@ -234,6 +252,60 @@ module FastExcel
234
252
  self.font_name = value
235
253
  end
236
254
  end
255
+
256
+ module RowExt
257
+ include AttributeHelper
258
+
259
+ def inspect
260
+ attr_str = fields_hash.map do |key, val|
261
+ "@#{key}=#{val.inspect}"
262
+ end
263
+ "<Libxlsxwriter::Row #{attr_str.join(" ")}>"
264
+ end
265
+ end
266
+
267
+ module CellExt
268
+ include AttributeHelper
269
+
270
+ def value
271
+ if self[:type] == :number_cell
272
+ self[:u][:number]
273
+ elsif self[:type] == :string_cell
274
+ pointer = self[:u][:string]
275
+ p pointer
276
+ pointer.null? ? nil : pointer.to_ptr.read_string
277
+ else
278
+ self[:user_data1]
279
+ end
280
+ end
281
+
282
+ def user_data1
283
+ value
284
+ #self[:user_data1] && !self[:user_data1].null? ? self[:user_data1].to_ptr.read_string : nil
285
+ end
286
+
287
+ def user_data2
288
+ self[:user_data2] #&& !self[:user_data2].null? ? self[:user_data2].to_ptr.read_string : nil
289
+ end
290
+
291
+ def sst_string
292
+ self[:sst_string] #&& !self[:sst_string].null? ? self[:sst_string].to_ptr.read_string : nil
293
+ end
294
+
295
+ #def inspect
296
+ # attr_str = fields_hash.map do |key, val|
297
+ # "@#{key}=#{val.inspect}"
298
+ # end
299
+ # "<Libxlsxwriter::Row #{attr_str.join(" ")}>"
300
+ #end
301
+
302
+ def inspect
303
+ attr_str = fields_hash.map do |key, val|
304
+ "@#{key}=#{val.inspect}"
305
+ end
306
+ "<Libxlsxwriter::Row #{attr_str.join(" ")}>"
307
+ end
308
+ end
237
309
  end
238
310
 
239
311
  Libxlsxwriter::Workbook.instance_eval do
@@ -246,4 +318,12 @@ end
246
318
 
247
319
  Libxlsxwriter::Worksheet.instance_eval do
248
320
  include FastExcel::WorksheetExt
249
- end
321
+ end
322
+
323
+ Libxlsxwriter::Row.instance_eval do
324
+ include FastExcel::RowExt
325
+ end
326
+
327
+ Libxlsxwriter::Cell.instance_eval do
328
+ include FastExcel::CellExt
329
+ end
@@ -1066,45 +1066,6 @@ module Libxlsxwriter
1066
1066
  :show_all, 3
1067
1067
  ]
1068
1068
 
1069
- # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:cell_types).</em>
1070
- #
1071
- # === Options:
1072
- # :number_cell ::
1073
- #
1074
- # :string_cell ::
1075
- #
1076
- # :inline_string_cell ::
1077
- #
1078
- # :formula_cell ::
1079
- #
1080
- # :array_formula_cell ::
1081
- #
1082
- # :blank_cell ::
1083
- #
1084
- # :boolean_cell ::
1085
- #
1086
- # :hyperlink_url ::
1087
- #
1088
- # :hyperlink_internal ::
1089
- #
1090
- # :hyperlink_external ::
1091
- #
1092
- #
1093
- # @method _enum_cell_types_
1094
- # @return [Symbol]
1095
- # @scope class
1096
- enum :cell_types, [
1097
- :number_cell, 1,
1098
- :string_cell, 2,
1099
- :inline_string_cell, 3,
1100
- :formula_cell, 4,
1101
- :array_formula_cell, 5,
1102
- :blank_cell, 6,
1103
- :boolean_cell, 7,
1104
- :hyperlink_url, 8,
1105
- :hyperlink_internal, 9,
1106
- :hyperlink_external, 10
1107
- ]
1108
1069
 
1109
1070
  # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:pane_types).</em>
1110
1071
  #
@@ -656,7 +656,7 @@ module Libxlsxwriter
656
656
  # @param [Integer] row_num
657
657
  # @return [Row]
658
658
  def find_row(row_num)
659
- Row.new Libxlsxwriter.worksheet_find_row(self, row_num)
659
+ Row.new(Libxlsxwriter.worksheet_find_row(self, row_num))
660
660
  end
661
661
  end
662
662
 
@@ -847,7 +847,7 @@ module Libxlsxwriter
847
847
  # :tree_pointers ::
848
848
  # (RowTreePointers)
849
849
  class Row < FFI::Struct
850
- layout :row_num, :uint,
850
+ layout :row_num, :uint32,
851
851
  :height, :double,
852
852
  :format, Format,
853
853
  :hidden, :uchar,
@@ -860,6 +860,46 @@ module Libxlsxwriter
860
860
  :tree_pointers, RowTreePointers.by_value
861
861
  end
862
862
 
863
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:cell_types).</em>
864
+ #
865
+ # === Options:
866
+ # :number_cell ::
867
+ #
868
+ # :string_cell ::
869
+ #
870
+ # :inline_string_cell ::
871
+ #
872
+ # :formula_cell ::
873
+ #
874
+ # :array_formula_cell ::
875
+ #
876
+ # :blank_cell ::
877
+ #
878
+ # :boolean_cell ::
879
+ #
880
+ # :hyperlink_url ::
881
+ #
882
+ # :hyperlink_internal ::
883
+ #
884
+ # :hyperlink_external ::
885
+ #
886
+ #
887
+ # @method _enum_cell_types_
888
+ # @return [Symbol]
889
+ # @scope class
890
+ enum :cell_types, [
891
+ :number_cell, 1,
892
+ :string_cell, 2,
893
+ :inline_string_cell, 3,
894
+ :formula_cell, 4,
895
+ :array_formula_cell, 5,
896
+ :blank_cell, 6,
897
+ :boolean_cell, 7,
898
+ :hyperlink_url, 8,
899
+ :hyperlink_internal, 9,
900
+ :hyperlink_external, 10
901
+ ]
902
+
863
903
  # = Fields:
864
904
  # :number ::
865
905
  # (Float)
@@ -870,7 +910,7 @@ module Libxlsxwriter
870
910
  class CellU < FFI::Union
871
911
  layout :number, :double,
872
912
  :string_id, :int,
873
- :string, :string
913
+ :string, :pointer
874
914
  end
875
915
 
876
916
  # = Fields:
@@ -911,15 +951,15 @@ module Libxlsxwriter
911
951
  # :tree_pointers ::
912
952
  # (CellTreePointers)
913
953
  class Cell < FFI::Struct
914
- layout :row_num, :uint,
915
- :col_num, :ushort,
954
+ layout :row_num, :uint32,
955
+ :col_num, :uint16,
916
956
  :type, :cell_types,
917
- :format, Format,
957
+ :format, :pointer,
918
958
  :u, CellU.by_value,
919
959
  :formula_result, :double,
920
- :user_data1, :string,
921
- :user_data2, :string,
922
- :sst_string, :string,
960
+ :user_data1, :pointer,
961
+ :user_data2, :pointer,
962
+ :sst_string, :pointer,
923
963
  :tree_pointers, CellTreePointers.by_value
924
964
  end
925
965
 
@@ -931,7 +971,7 @@ module Libxlsxwriter
931
971
  # @param [Format] format
932
972
  # @return [Symbol from _enum_error_]
933
973
  # @scope class
934
- attach_function :worksheet_write_number, :worksheet_write_number, [Worksheet, :uint, :ushort, :double, Format], :error
974
+ attach_function :worksheet_write_number, :worksheet_write_number, [Worksheet, :uint32, :ushort, :double, Format], :error
935
975
 
936
976
  # @method worksheet_write_string(worksheet, row, col, string, format)
937
977
  # @param [Worksheet] worksheet
@@ -941,7 +981,7 @@ module Libxlsxwriter
941
981
  # @param [Format] format
942
982
  # @return [Symbol from _enum_error_]
943
983
  # @scope class
944
- attach_function :worksheet_write_string, :worksheet_write_string, [Worksheet, :uint, :ushort, :string, Format], :error
984
+ attach_function :worksheet_write_string, :worksheet_write_string, [Worksheet, :uint32, :ushort, :string, Format], :error
945
985
 
946
986
  # @method worksheet_write_formula(worksheet, row, col, formula, format)
947
987
  # @param [Worksheet] worksheet
@@ -951,7 +991,7 @@ module Libxlsxwriter
951
991
  # @param [Format] format
952
992
  # @return [Symbol from _enum_error_]
953
993
  # @scope class
954
- attach_function :worksheet_write_formula, :worksheet_write_formula, [Worksheet, :uint, :ushort, :string, Format], :error
994
+ attach_function :worksheet_write_formula, :worksheet_write_formula, [Worksheet, :uint32, :ushort, :string, Format], :error
955
995
 
956
996
  # @method worksheet_write_array_formula(worksheet, first_row, first_col, last_row, last_col, formula, format)
957
997
  # @param [Worksheet] worksheet
@@ -963,7 +1003,7 @@ module Libxlsxwriter
963
1003
  # @param [Format] format
964
1004
  # @return [Symbol from _enum_error_]
965
1005
  # @scope class
966
- attach_function :worksheet_write_array_formula, :worksheet_write_array_formula, [Worksheet, :uint, :ushort, :uint, :ushort, :string, Format], :error
1006
+ attach_function :worksheet_write_array_formula, :worksheet_write_array_formula, [Worksheet, :uint32, :ushort, :uint, :ushort, :string, Format], :error
967
1007
 
968
1008
  # @method worksheet_write_array_formula_num(worksheet, first_row, first_col, last_row, last_col, formula, format, result)
969
1009
  # @param [Worksheet] worksheet
@@ -976,7 +1016,7 @@ module Libxlsxwriter
976
1016
  # @param [Float] result
977
1017
  # @return [Symbol from _enum_error_]
978
1018
  # @scope class
979
- attach_function :worksheet_write_array_formula_num, :worksheet_write_array_formula_num, [Worksheet, :uint, :ushort, :uint, :ushort, :string, Format, :double], :error
1019
+ attach_function :worksheet_write_array_formula_num, :worksheet_write_array_formula_num, [Worksheet, :uint32, :ushort, :uint, :ushort, :string, Format, :double], :error
980
1020
 
981
1021
  # @method worksheet_write_datetime(worksheet, row, col, datetime, format)
982
1022
  # @param [Worksheet] worksheet
@@ -986,7 +1026,7 @@ module Libxlsxwriter
986
1026
  # @param [Format] format
987
1027
  # @return [Symbol from _enum_error_]
988
1028
  # @scope class
989
- attach_function :worksheet_write_datetime, :worksheet_write_datetime, [Worksheet, :uint, :ushort, Datetime, Format], :error
1029
+ attach_function :worksheet_write_datetime, :worksheet_write_datetime, [Worksheet, :uint32, :ushort, Datetime, Format], :error
990
1030
 
991
1031
  # @method worksheet_write_url_opt(worksheet, row_num, col_num, url, format, string, tooltip)
992
1032
  # @param [Worksheet] worksheet
@@ -998,7 +1038,7 @@ module Libxlsxwriter
998
1038
  # @param [String] tooltip
999
1039
  # @return [Symbol from _enum_error_]
1000
1040
  # @scope class
1001
- attach_function :worksheet_write_url_opt, :worksheet_write_url_opt, [Worksheet, :uint, :ushort, :string, Format, :string, :string], :error
1041
+ attach_function :worksheet_write_url_opt, :worksheet_write_url_opt, [Worksheet, :uint32, :ushort, :string, Format, :string, :string], :error
1002
1042
 
1003
1043
  # @method worksheet_write_url(worksheet, row, col, url, format)
1004
1044
  # @param [Worksheet] worksheet
@@ -1008,7 +1048,7 @@ module Libxlsxwriter
1008
1048
  # @param [Format] format
1009
1049
  # @return [Symbol from _enum_error_]
1010
1050
  # @scope class
1011
- attach_function :worksheet_write_url, :worksheet_write_url, [Worksheet, :uint, :ushort, :string, Format], :error
1051
+ attach_function :worksheet_write_url, :worksheet_write_url, [Worksheet, :uint32, :ushort, :string, Format], :error
1012
1052
 
1013
1053
  # @method worksheet_write_boolean(worksheet, row, col, value, format)
1014
1054
  # @param [Worksheet] worksheet
@@ -1018,7 +1058,7 @@ module Libxlsxwriter
1018
1058
  # @param [Format] format
1019
1059
  # @return [Symbol from _enum_error_]
1020
1060
  # @scope class
1021
- attach_function :worksheet_write_boolean, :worksheet_write_boolean, [Worksheet, :uint, :ushort, :int, Format], :error
1061
+ attach_function :worksheet_write_boolean, :worksheet_write_boolean, [Worksheet, :uint32, :ushort, :int, Format], :error
1022
1062
 
1023
1063
  # @method worksheet_write_blank(worksheet, row, col, format)
1024
1064
  # @param [Worksheet] worksheet
@@ -1027,7 +1067,7 @@ module Libxlsxwriter
1027
1067
  # @param [Format] format
1028
1068
  # @return [Symbol from _enum_error_]
1029
1069
  # @scope class
1030
- attach_function :worksheet_write_blank, :worksheet_write_blank, [Worksheet, :uint, :ushort, Format], :error
1070
+ attach_function :worksheet_write_blank, :worksheet_write_blank, [Worksheet, :uint32, :ushort, Format], :error
1031
1071
 
1032
1072
  # @method worksheet_write_formula_num(worksheet, row, col, formula, format, result)
1033
1073
  # @param [Worksheet] worksheet
@@ -1038,7 +1078,7 @@ module Libxlsxwriter
1038
1078
  # @param [Float] result
1039
1079
  # @return [Symbol from _enum_error_]
1040
1080
  # @scope class
1041
- attach_function :worksheet_write_formula_num, :worksheet_write_formula_num, [Worksheet, :uint, :ushort, :string, Format, :double], :error
1081
+ attach_function :worksheet_write_formula_num, :worksheet_write_formula_num, [Worksheet, :uint32, :ushort, :string, Format, :double], :error
1042
1082
 
1043
1083
  # @method worksheet_set_row(worksheet, row, height, format)
1044
1084
  # @param [Worksheet] worksheet
@@ -1047,7 +1087,7 @@ module Libxlsxwriter
1047
1087
  # @param [Format] format
1048
1088
  # @return [Symbol from _enum_error_]
1049
1089
  # @scope class
1050
- attach_function :worksheet_set_row, :worksheet_set_row, [Worksheet, :uint, :double, Format], :error
1090
+ attach_function :worksheet_set_row, :worksheet_set_row, [Worksheet, :uint32, :double, Format], :error
1051
1091
 
1052
1092
  # @method worksheet_set_row_opt(worksheet, row, height, format, options)
1053
1093
  # @param [Worksheet] worksheet
@@ -1057,7 +1097,7 @@ module Libxlsxwriter
1057
1097
  # @param [RowColOptions] options
1058
1098
  # @return [Symbol from _enum_error_]
1059
1099
  # @scope class
1060
- attach_function :worksheet_set_row_opt, :worksheet_set_row_opt, [Worksheet, :uint, :double, Format, RowColOptions], :error
1100
+ attach_function :worksheet_set_row_opt, :worksheet_set_row_opt, [Worksheet, :uint32, :double, Format, RowColOptions], :error
1061
1101
 
1062
1102
  # @method worksheet_set_column(worksheet, first_col, last_col, width, format)
1063
1103
  # @param [Worksheet] worksheet
@@ -1087,7 +1127,7 @@ module Libxlsxwriter
1087
1127
  # @param [String] filename
1088
1128
  # @return [Symbol from _enum_error_]
1089
1129
  # @scope class
1090
- attach_function :worksheet_insert_image, :worksheet_insert_image, [Worksheet, :uint, :ushort, :string], :error
1130
+ attach_function :worksheet_insert_image, :worksheet_insert_image, [Worksheet, :uint32, :ushort, :string], :error
1091
1131
 
1092
1132
  # @method worksheet_insert_image_opt(worksheet, row, col, filename, options)
1093
1133
  # @param [Worksheet] worksheet
@@ -1097,7 +1137,7 @@ module Libxlsxwriter
1097
1137
  # @param [ImageOptions] options
1098
1138
  # @return [Symbol from _enum_error_]
1099
1139
  # @scope class
1100
- attach_function :worksheet_insert_image_opt, :worksheet_insert_image_opt, [Worksheet, :uint, :ushort, :string, ImageOptions], :error
1140
+ attach_function :worksheet_insert_image_opt, :worksheet_insert_image_opt, [Worksheet, :uint32, :ushort, :string, ImageOptions], :error
1101
1141
 
1102
1142
  # @method worksheet_insert_chart(worksheet, row, col, chart)
1103
1143
  # @param [Worksheet] worksheet
@@ -1106,7 +1146,7 @@ module Libxlsxwriter
1106
1146
  # @param [Chart] chart
1107
1147
  # @return [Symbol from _enum_error_]
1108
1148
  # @scope class
1109
- attach_function :worksheet_insert_chart, :worksheet_insert_chart, [Worksheet, :uint, :ushort, Chart], :error
1149
+ attach_function :worksheet_insert_chart, :worksheet_insert_chart, [Worksheet, :uint32, :ushort, Chart], :error
1110
1150
 
1111
1151
  # @method worksheet_insert_chart_opt(worksheet, row, col, chart, user_options)
1112
1152
  # @param [Worksheet] worksheet
@@ -1116,7 +1156,7 @@ module Libxlsxwriter
1116
1156
  # @param [ImageOptions] user_options
1117
1157
  # @return [Symbol from _enum_error_]
1118
1158
  # @scope class
1119
- attach_function :worksheet_insert_chart_opt, :worksheet_insert_chart_opt, [Worksheet, :uint, :ushort, Chart, ImageOptions], :error
1159
+ attach_function :worksheet_insert_chart_opt, :worksheet_insert_chart_opt, [Worksheet, :uint32, :ushort, Chart, ImageOptions], :error
1120
1160
 
1121
1161
  # @method worksheet_merge_range(worksheet, first_row, first_col, last_row, last_col, string, format)
1122
1162
  # @param [Worksheet] worksheet
@@ -1128,7 +1168,7 @@ module Libxlsxwriter
1128
1168
  # @param [Format] format
1129
1169
  # @return [Symbol from _enum_error_]
1130
1170
  # @scope class
1131
- attach_function :worksheet_merge_range, :worksheet_merge_range, [Worksheet, :uint, :ushort, :uint, :ushort, :string, Format], :error
1171
+ attach_function :worksheet_merge_range, :worksheet_merge_range, [Worksheet, :uint32, :ushort, :uint32, :ushort, :string, Format], :error
1132
1172
 
1133
1173
  # @method worksheet_autofilter(worksheet, first_row, first_col, last_row, last_col)
1134
1174
  # @param [Worksheet] worksheet
@@ -1458,7 +1498,7 @@ module Libxlsxwriter
1458
1498
  # @param [Integer] row_num
1459
1499
  # @return [Row]
1460
1500
  # @scope class
1461
- attach_function :worksheet_find_row, :lxw_worksheet_find_row, [Worksheet, :uint], Row
1501
+ attach_function :worksheet_find_row, :lxw_worksheet_find_row, [Worksheet, :uint32], Row
1462
1502
 
1463
1503
  # @method worksheet_find_cell(row, col_num)
1464
1504
  # @param [Row] row
data/test/tmpfile_test.rb CHANGED
@@ -6,7 +6,7 @@ describe "FastExcel" do
6
6
  workbook = FastExcel.open(constant_memory: true)
7
7
 
8
8
  assert(workbook.tmp_file)
9
- assert_match(/fast_excel.xslx$/, workbook.filename)
9
+ assert_match(/fast_excel.xlsx$/, workbook.filename)
10
10
 
11
11
  result = workbook.read_string
12
12
  assert(result.size > 1000)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_excel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Evstigneev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-23 00:00:00.000000000 Z
11
+ date: 2017-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -39,6 +39,7 @@ extensions:
39
39
  extra_rdoc_files: []
40
40
  files:
41
41
  - ".gitignore"
42
+ - CHANGELOG.md
42
43
  - Gemfile
43
44
  - Gemfile.lock
44
45
  - Makefile
@@ -50,6 +51,7 @@ files:
50
51
  - benchmarks/memory.rb
51
52
  - examples/example.rb
52
53
  - examples/example_chart.rb
54
+ - examples/example_formula.rb
53
55
  - examples/example_image.rb
54
56
  - extconf.rb
55
57
  - fast_excel.gemspec