fast_excel 0.4.1 → 0.5.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.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +1 -7
  3. data/CHANGELOG.md +9 -0
  4. data/Gemfile +1 -1
  5. data/examples/example.rb +2 -0
  6. data/examples/example_date_time.rb +38 -0
  7. data/fast_excel.gemspec +2 -2
  8. data/lib/fast_excel/binding/format.rb +17 -0
  9. data/lib/fast_excel/binding/workbook.rb +39 -17
  10. data/lib/fast_excel/binding/worksheet.rb +57 -13
  11. data/lib/fast_excel/binding.rb +7 -7
  12. data/lib/fast_excel.rb +27 -20
  13. data/libxlsxwriter/.github/FUNDING.yml +1 -0
  14. data/libxlsxwriter/.github/ISSUE_TEMPLATE.md +85 -0
  15. data/libxlsxwriter/.github/PULL_REQUEST_TEMPLATE.md +130 -0
  16. data/libxlsxwriter/.github/workflows/cmake_actions.yml +48 -0
  17. data/libxlsxwriter/.github/workflows/code_style.yml +23 -0
  18. data/libxlsxwriter/.github/workflows/coverity.yml +22 -0
  19. data/libxlsxwriter/.github/workflows/make_actions.yml +52 -0
  20. data/libxlsxwriter/.github/workflows/valgrind.yml +23 -0
  21. data/libxlsxwriter/.github/workflows/windows_build.yml +54 -0
  22. data/libxlsxwriter/.github/workflows/zig_build.yml +22 -0
  23. data/libxlsxwriter/.gitignore +16 -1
  24. data/libxlsxwriter/.indent.pro +24 -0
  25. data/libxlsxwriter/CMakeLists.txt +156 -56
  26. data/libxlsxwriter/CONTRIBUTING.md +2 -2
  27. data/libxlsxwriter/Changes.txt +344 -2
  28. data/libxlsxwriter/LICENSE.txt +66 -8
  29. data/libxlsxwriter/Makefile +151 -54
  30. data/libxlsxwriter/Package.swift +42 -0
  31. data/libxlsxwriter/Readme.md +4 -2
  32. data/libxlsxwriter/build.zig +324 -0
  33. data/libxlsxwriter/build.zig.zon +11 -0
  34. data/libxlsxwriter/cmake/FindMINIZIP.cmake +3 -3
  35. data/libxlsxwriter/cocoapods/libxlsxwriter-umbrella.h +6 -0
  36. data/libxlsxwriter/include/xlsxwriter/app.h +2 -1
  37. data/libxlsxwriter/include/xlsxwriter/chart.h +236 -32
  38. data/libxlsxwriter/include/xlsxwriter/chartsheet.h +7 -7
  39. data/libxlsxwriter/include/xlsxwriter/comment.h +76 -0
  40. data/libxlsxwriter/include/xlsxwriter/common.h +111 -50
  41. data/libxlsxwriter/include/xlsxwriter/content_types.h +8 -1
  42. data/libxlsxwriter/include/xlsxwriter/core.h +1 -1
  43. data/libxlsxwriter/include/xlsxwriter/custom.h +1 -1
  44. data/libxlsxwriter/include/xlsxwriter/drawing.h +11 -20
  45. data/libxlsxwriter/include/xlsxwriter/format.h +121 -8
  46. data/libxlsxwriter/include/xlsxwriter/hash_table.h +1 -1
  47. data/libxlsxwriter/include/xlsxwriter/metadata.h +49 -0
  48. data/libxlsxwriter/include/xlsxwriter/packager.h +27 -16
  49. data/libxlsxwriter/include/xlsxwriter/relationships.h +1 -1
  50. data/libxlsxwriter/include/xlsxwriter/shared_strings.h +1 -1
  51. data/libxlsxwriter/include/xlsxwriter/styles.h +13 -7
  52. data/libxlsxwriter/include/xlsxwriter/table.h +51 -0
  53. data/libxlsxwriter/include/xlsxwriter/theme.h +1 -1
  54. data/libxlsxwriter/include/xlsxwriter/third_party/emyg_dtoa.h +26 -0
  55. data/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h +27 -25
  56. data/libxlsxwriter/include/xlsxwriter/third_party/md5.h +45 -0
  57. data/libxlsxwriter/include/xlsxwriter/third_party/zip.h +155 -153
  58. data/libxlsxwriter/include/xlsxwriter/utility.h +70 -8
  59. data/libxlsxwriter/include/xlsxwriter/vml.h +55 -0
  60. data/libxlsxwriter/include/xlsxwriter/workbook.h +218 -47
  61. data/libxlsxwriter/include/xlsxwriter/worksheet.h +2770 -241
  62. data/libxlsxwriter/include/xlsxwriter/xmlwriter.h +12 -8
  63. data/libxlsxwriter/include/xlsxwriter.h +4 -2
  64. data/libxlsxwriter/libxlsxwriter.podspec +8 -5
  65. data/libxlsxwriter/src/Makefile +58 -21
  66. data/libxlsxwriter/src/app.c +5 -2
  67. data/libxlsxwriter/src/chart.c +396 -81
  68. data/libxlsxwriter/src/chartsheet.c +22 -22
  69. data/libxlsxwriter/src/comment.c +443 -0
  70. data/libxlsxwriter/src/content_types.c +40 -1
  71. data/libxlsxwriter/src/core.c +2 -2
  72. data/libxlsxwriter/src/custom.c +1 -1
  73. data/libxlsxwriter/src/drawing.c +160 -40
  74. data/libxlsxwriter/src/format.c +109 -25
  75. data/libxlsxwriter/src/hash_table.c +1 -1
  76. data/libxlsxwriter/src/metadata.c +283 -0
  77. data/libxlsxwriter/src/packager.c +794 -94
  78. data/libxlsxwriter/src/relationships.c +1 -1
  79. data/libxlsxwriter/src/shared_strings.c +2 -4
  80. data/libxlsxwriter/src/styles.c +353 -58
  81. data/libxlsxwriter/src/table.c +304 -0
  82. data/libxlsxwriter/src/theme.c +1 -1
  83. data/libxlsxwriter/src/utility.c +143 -43
  84. data/libxlsxwriter/src/vml.c +1062 -0
  85. data/libxlsxwriter/src/workbook.c +567 -77
  86. data/libxlsxwriter/src/worksheet.c +6668 -1462
  87. data/libxlsxwriter/src/xmlwriter.c +95 -5
  88. data/libxlsxwriter/third_party/dtoa/Makefile +42 -0
  89. data/libxlsxwriter/third_party/dtoa/emyg_dtoa.c +461 -0
  90. data/libxlsxwriter/third_party/dtoa/emyg_dtoa.h +26 -0
  91. data/libxlsxwriter/third_party/md5/Makefile +42 -0
  92. data/libxlsxwriter/third_party/md5/md5.c +291 -0
  93. data/libxlsxwriter/third_party/md5/md5.h +45 -0
  94. data/libxlsxwriter/third_party/minizip/Makefile +3 -8
  95. data/libxlsxwriter/third_party/minizip/Makefile.orig +8 -4
  96. data/libxlsxwriter/third_party/minizip/MiniZip64_Changes.txt +1 -1
  97. data/libxlsxwriter/third_party/minizip/configure.ac +1 -1
  98. data/libxlsxwriter/third_party/minizip/crypt.h +13 -16
  99. data/libxlsxwriter/third_party/minizip/ioapi.c +31 -57
  100. data/libxlsxwriter/third_party/minizip/ioapi.h +31 -23
  101. data/libxlsxwriter/third_party/minizip/iowin32.c +29 -45
  102. data/libxlsxwriter/third_party/minizip/iowin32.h +4 -4
  103. data/libxlsxwriter/third_party/minizip/miniunz.c +29 -56
  104. data/libxlsxwriter/third_party/minizip/minizip.c +38 -49
  105. data/libxlsxwriter/third_party/minizip/mztools.c +1 -7
  106. data/libxlsxwriter/third_party/minizip/unzip.c +202 -342
  107. data/libxlsxwriter/third_party/minizip/unzip.h +74 -74
  108. data/libxlsxwriter/third_party/minizip/zip.c +165 -218
  109. data/libxlsxwriter/third_party/minizip/zip.h +164 -154
  110. data/libxlsxwriter/third_party/tmpfileplus/Makefile +3 -3
  111. data/libxlsxwriter/version.txt +1 -1
  112. data/test/auto_width_test.rb +20 -0
  113. data/test/default_format_test.rb +1 -1
  114. data/test/validations_test.rb +3 -3
  115. data/test/worksheet_test.rb +6 -1
  116. metadata +33 -7
  117. data/libxlsxwriter/.travis.yml +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81f6dc41f599591425a032e95046733c9a27b7b44e5f6d15f71c9040e1452eaf
4
- data.tar.gz: 05ce040ed72e6c056311177c5753d6f363d8750515502054648cac440d3cde09
3
+ metadata.gz: 792a2afe9492aeeaba9fbb65da941d2b604a2fd14bf934b17662fdf05281ac32
4
+ data.tar.gz: 11795006b99d4fc9403fd3f85ab6babff417b1ed49341a2081073852063d2a71
5
5
  SHA512:
6
- metadata.gz: f614c8458db906397a2c27825c302e4a0d7a3f2958ed7053a33c9bd2dcbfd063fd27e5a6a8b1a7b3d230afc23919f359d27e61b785ded07b6cf95de55081d711
7
- data.tar.gz: cbc0d5436ddde9052359e069a2d4e706810b9bd9ed28c544eca6e072566d32af9fba8b762cb47c011400d676dc71d7b641902058758f97cab98f44a9baef5ff9
6
+ metadata.gz: 7215d937426efb2580ba947c727a60a519fb411a5504eb58162a1646057bd191812eae00394ac9c915a9f7f53a6acf6cfff66e4d773a8ac579bb3494164c3292
7
+ data.tar.gz: 9f381f209a7d4f7c22a0994ed241b2be0a67d994c400f7867529fa1fa95fbc6326189a9dc53588f0bfbc376933ffab6fee4eaee37f7ac57d6a4f68a66295c8cc
@@ -8,7 +8,7 @@ jobs:
8
8
  fail-fast: false
9
9
  matrix:
10
10
  os: [ubuntu-latest, macos-latest, windows-latest]
11
- ruby: [2.7, '3.0', 3.1, 3.2]
11
+ ruby: [2.7, '3.0', 3.1, 3.2, 3.3]
12
12
 
13
13
  runs-on: ${{ matrix.os }}
14
14
 
@@ -26,9 +26,3 @@ jobs:
26
26
  - run: rake test
27
27
  - run: rake examples
28
28
  - run: gem build fast_excel.gemspec
29
-
30
-
31
- gobills-critical
32
- gp-di-critical
33
-
34
- gp-di-alert
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ #### Version 0.5.0 - 02 jan 2024
2
+
3
+ * Support ruby 3.3
4
+ * Sync latest libxlsxwriter
5
+ * Add support for writing cell comments
6
+ * Add more examples
7
+ * Fix compilation of minizip on NixOS (Thanks to @Mange)
8
+ * On close set empty columns to default width (Thanks to @steffansluis)
9
+
1
10
  #### Version 0.4.1 - 13 jan 2023
2
11
 
3
12
  * Support ruby 3.2
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ gemspec
4
4
 
5
5
  gem 'rake'
6
6
 
7
- gem 'roo', '2.8.3', git: 'https://github.com/roo-rb/roo.git', tag: 'v2.8.3'
7
+ gem 'roo'
8
8
 
9
9
  gem 'minitest'
10
10
  gem 'minitest-reporters'
data/examples/example.rb CHANGED
@@ -22,6 +22,8 @@ worksheet.set_column(2, 2, 20, date_format)
22
22
 
23
23
  worksheet.write_row(0, ["message", "price", "date", "complete"], bold)
24
24
 
25
+ worksheet.write_comment(2, 2, "Comment to field")
26
+
25
27
  for i in 1..1000
26
28
  worksheet.write_row(i, ["Hello", (rand * 10_000_000).round(2), Time.now, i % 2 == 0])
27
29
 
@@ -0,0 +1,38 @@
1
+ require_relative '../lib/fast_excel'
2
+
3
+ require 'date'
4
+ require 'time'
5
+
6
+
7
+ File.unlink("example_date_time.xlsx") if File.exist?("example_date_time.xlsx")
8
+
9
+ workbook = FastExcel.open("example_date_time.xlsx", constant_memory: true)
10
+ workbook.default_format.set(
11
+ font_size: 0, # user's default
12
+ )
13
+ worksheet = workbook.add_worksheet
14
+
15
+ worksheet.set_columns_width(0, 4, 25)
16
+ worksheet.set_column(1, 1, 25, workbook.number_format("[$-409]m/d/yy hh:mm;@"))
17
+
18
+ intro = "Date and time in excel file stored as decimal number, it show number of days since January 1900, decimal part is for time of the day"
19
+ worksheet.merge_range(0, 0, 0, 4, intro, nil)
20
+ worksheet.write_value(1, 0, "")
21
+
22
+ worksheet.append_row(['', 'Formatted as Date', 'No formatting, plain number'])
23
+
24
+ worksheet.append_row(["Time.now", Time.now, Time.now, 'local timezone'])
25
+ worksheet.append_row(["Time.now.utc", Time.now.utc, Time.now.utc, 'UTC timezone'])
26
+
27
+ worksheet.append_row(["DateTime.now", DateTime.now, DateTime.now, 'local timezone'])
28
+ dt = DateTime.now.new_offset("+02:00")
29
+ worksheet.append_row(["DateTime new_offset", dt, dt, 'GMT+2 timezone'])
30
+
31
+ today = Date.today
32
+ worksheet.append_row(["Date.today", today, today])
33
+
34
+ worksheet.append_row(["0 (just zero)", 0, 0, '00 January 1900'])
35
+
36
+
37
+ workbook.close
38
+ puts "Saved to file example_date_time.xlsx"
data/fast_excel.gemspec CHANGED
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "fast_excel"
3
- s.version = "0.4.1"
3
+ s.version = "0.5.0"
4
4
  s.author = ["Pavel Evstigneev"]
5
5
  s.email = ["pavel.evst@gmail.com"]
6
6
  s.homepage = "https://github.com/paxa/fast_excel"
7
7
  s.summary = %q{Ultra Fast Excel Writer}
8
8
  s.description = "Wrapper for libxlsxwriter using ffi"
9
9
  s.license = 'MIT'
10
- s.required_ruby_version = ['>= 2.0', '< 4.0']
10
+ s.required_ruby_version = ['>= 2.0']
11
11
 
12
12
  s.files = `git ls-files`.split("\n")
13
13
  s.test_files = []
@@ -697,9 +697,14 @@ module Libxlsxwriter
697
697
  include FormatWrappers
698
698
  layout :file, :pointer,
699
699
  :xf_format_indices, :pointer, #HashTable.ptr,
700
+ :dxf_format_indices, :pointer,
700
701
  :num_xf_formats, :pointer,
702
+ :num_dxf_formats, :pointer,
703
+
701
704
  :xf_index, :int32_t,
702
705
  :dxf_index, :int32_t,
706
+ :xf_id, :int32_t,
707
+
703
708
  :num_format, [:char, 128],
704
709
  :font_name, [:char, 128],
705
710
  :font_scheme, [:char, 128],
@@ -708,6 +713,7 @@ module Libxlsxwriter
708
713
  :has_font, :uchar,
709
714
  :has_dxf_font, :uchar,
710
715
  :font_size, :double,
716
+
711
717
  :bold, :uchar,
712
718
  :italic, :uchar,
713
719
  :font_color, :int,
@@ -722,24 +728,32 @@ module Libxlsxwriter
722
728
  :font_extend, :uchar,
723
729
  :theme, :uchar,
724
730
  :hyperlink, :uchar,
731
+
725
732
  :hidden, :uchar,
726
733
  :locked, :uchar,
734
+
727
735
  :text_h_align, :uchar,
728
736
  :text_wrap, :uchar,
729
737
  :text_v_align, :uchar,
730
738
  :text_justlast, :uchar,
731
739
  :rotation, :short,
740
+
732
741
  :fg_color, :int,
733
742
  :bg_color, :int,
743
+ :dxf_fg_color, :int,
744
+ :dxf_bg_color, :int,
745
+
734
746
  :pattern, :uchar,
735
747
  :has_fill, :uchar,
736
748
  :has_dxf_fill, :uchar,
737
749
  :fill_index, :int,
738
750
  :fill_count, :int,
751
+
739
752
  :border_index, :int,
740
753
  :has_border, :uchar,
741
754
  :has_dxf_border, :uchar,
742
755
  :border_count, :int,
756
+
743
757
  :bottom, :uchar,
744
758
  :diag_border, :uchar,
745
759
  :diag_type, :uchar,
@@ -751,6 +765,7 @@ module Libxlsxwriter
751
765
  :left_color, :int,
752
766
  :right_color, :int,
753
767
  :top_color, :int,
768
+
754
769
  :indent, :uchar,
755
770
  :shrink, :uchar,
756
771
  :merge_range, :uchar,
@@ -758,6 +773,8 @@ module Libxlsxwriter
758
773
  :just_distrib, :uchar,
759
774
  :color_indexed, :uchar,
760
775
  :font_only, :uchar,
776
+
777
+ :quote_prefix, :uchar,
761
778
  :list_pointers, FormatListPointers.by_value
762
779
  end
763
780
 
@@ -7,7 +7,9 @@ module Libxlsxwriter
7
7
  class WorkbookOptions < FFI::Struct
8
8
  layout :constant_memory, :uchar,
9
9
  :tmpdir, :string,
10
- :use_zip64, :uchar
10
+ :use_zip64, :uchar,
11
+ :output_buffer, :pointer,
12
+ :output_buffer_size, :pointer
11
13
  end
12
14
 
13
15
  # = Fields:
@@ -174,6 +176,9 @@ module Libxlsxwriter
174
176
  :chartsheets, :pointer,
175
177
  :worksheet_names, WorksheetNames.ptr,
176
178
  :chartsheet_names, :pointer,
179
+ :image_md5s, :pointer,
180
+ :header_image_md5s, :pointer,
181
+ :background_md5s, :pointer,
177
182
  :charts, Charts.ptr,
178
183
  :ordered_charts, Charts.ptr,
179
184
  :formats, Formats.ptr,
@@ -181,26 +186,43 @@ module Libxlsxwriter
181
186
  :sst, Sst.ptr,
182
187
  :properties, DocProperties.ptr,
183
188
  :custom_properties, CustomProperties.ptr,
184
- :filename, :pointer,
189
+ :filename, :string,
185
190
  :options, WorkbookOptions.by_value,
186
- :num_sheets, :uint16,
187
- :num_worksheets, :uint16,
188
- :num_chartsheets, :uint16,
189
- :first_sheet, :uint16,
190
- :active_sheet, :uint16,
191
- :num_xf_formats, :uint16,
191
+
192
+ :num_sheets, :uint16,
193
+ :num_worksheets, :uint16,
194
+ :num_chartsheets, :uint16,
195
+ :first_sheet, :uint16,
196
+ :active_sheet, :uint16,
197
+ :num_xf_formats, :uint16,
198
+ :num_dxf_formats, :uint16,
192
199
  :num_format_count, :uint16,
193
- :drawing_count, :uint16,
194
- :font_count, :uint16,
195
- :border_count, :uint16,
196
- :fill_count, :uint16,
197
- :optimize, :uchar,
198
- :has_png, :uchar,
200
+ :drawing_count, :uint16,
201
+ :comment_count, :uint16,
202
+
203
+ :font_count, :uint16,
204
+ :border_count, :uint16,
205
+ :fill_count, :uint16,
206
+ :optimize, :uchar,
207
+ :max_url_length, :uint16,
208
+ :read_only, :uchar,
209
+
210
+ :has_png, :uchar,
199
211
  :has_jpeg, :uchar,
200
- :has_bmp, :uchar,
212
+ :has_bmp, :uchar,
213
+ :has_gif, :uchar,
214
+ :has_vml, :uchar,
215
+ :has_comments, :uchar,
216
+ :has_metadata, :uchar,
217
+
201
218
  :used_xf_formats, HashTable.ptr,
202
- :vba_project, :pointer,
203
- :vba_codename, :pointer
219
+ :used_dxf_formats, HashTable.ptr,
220
+
221
+ :vba_project, :string,
222
+ :vba_project_signature, :string,
223
+ :vba_codename, :string,
224
+
225
+ :default_url_format, :pointer
204
226
  end
205
227
 
206
228
  attach_function :workbook_default_format, :workbook_default_format, [Workbook], Format
@@ -209,7 +209,11 @@ module Libxlsxwriter
209
209
  def write_string(row, col, string, format)
210
210
  Libxlsxwriter.worksheet_write_string(self, row, col, string, format)
211
211
  end
212
-
212
+
213
+ def write_comment(row, col, string)
214
+ Libxlsxwriter.worksheet_write_comment(self, row, col, string)
215
+ end
216
+
213
217
  # @param [Integer] row
214
218
  # @param [Integer] col
215
219
  # @param [String] formula
@@ -684,29 +688,45 @@ module Libxlsxwriter
684
688
  include WorksheetWrappers
685
689
  layout :file, :pointer,
686
690
  :optimize_tmpfile, :pointer,
691
+ :optimize_buffer, :pointer,
692
+ :optimize_buffer_size, :size_t,
687
693
  :table, TableRows.ptr,
688
694
  :hyperlinks, TableRows.ptr,
695
+ :comments, TableRows.ptr,
689
696
  :array, :pointer,
690
697
  :merged_ranges, MergedRanges.ptr,
691
- :selections, Selections.ptr,
698
+ #:selections, Selections.ptr,
692
699
  :data_validations, :pointer, # TODO add real definition for lxw_data_validations
700
+ :conditional_formats, :pointer,
701
+ :image_props, :pointer,
693
702
  :image_data, ImageData.ptr,
694
703
  :chart_data, ChartData.ptr,
704
+ :drawing_rel_ids, :pointer,
705
+ :vml_drawing_rel_ids, :pointer,
706
+ :comment_objs, :pointer,
707
+ :header_image_objs, :pointer,
708
+ :button_objs, :pointer,
709
+ :table_objs, :pointer,
710
+ :table_count, :uint16,
711
+
695
712
  :dim_rowmin, :uint32,
696
713
  :dim_rowmax, :uint32,
697
714
  :dim_colmin, :uint16,
698
715
  :dim_colmax, :uint16,
716
+
699
717
  :sst, Sst.ptr,
700
718
  :name, :string,
701
719
  :quoted_name, :string,
702
720
  :tmpdir, :pointer,
703
- :index, :uint32,
704
- :active, :uint8,
705
- :selected, :uint8,
706
- :hidden, :uint8,
721
+
722
+ :index, :uint16,
723
+ :active, :uchar,
724
+ :selected, :uchar,
725
+ :hidden, :uchar,
707
726
  :active_sheet, :pointer,
708
727
  :first_sheet, :pointer,
709
- :is_chartsheet, :uint8,
728
+ :is_chartsheet, :uchar,
729
+
710
730
  :col_options, :pointer,
711
731
  :col_options_max, :uint16,
712
732
  :col_sizes, :pointer,
@@ -717,6 +737,7 @@ module Libxlsxwriter
717
737
  :row_size_changed, :uint8,
718
738
  :optimize, :uint8,
719
739
  :optimize_row, :pointer,
740
+
720
741
  :fit_height, :uint16,
721
742
  :fit_width, :uint16,
722
743
  :horizontal_dpi, :uint16,
@@ -726,6 +747,7 @@ module Libxlsxwriter
726
747
  :rel_count, :uint16,
727
748
  :vertical_dpi, :uint16,
728
749
  :zoom, :uint16,
750
+
729
751
  :filter_on, :uint8,
730
752
  :fit_page, :uint8,
731
753
  :hcenter, :uint8,
@@ -747,8 +769,12 @@ module Libxlsxwriter
747
769
  :show_zeros, :uint8,
748
770
  :vcenter, :uint8,
749
771
  :zoom_scale_normal, :uint8,
772
+ :black_white, :uint8,
750
773
  :num_validations, :uint8,
774
+ :has_dynamic_arrays, :uint8,
775
+
751
776
  :vba_codename, :pointer,
777
+ :num_buttons, :uint16,
752
778
  :tab_color, :int,
753
779
  :margin_left, :double,
754
780
  :margin_right, :double,
@@ -756,30 +782,44 @@ module Libxlsxwriter
756
782
  :margin_bottom, :double,
757
783
  :margin_header, :double,
758
784
  :margin_footer, :double,
785
+
759
786
  :default_row_height, :double,
760
787
  :default_row_pixels, :uint,
761
788
  :default_col_pixels, :uint,
762
- :default_row_zeroed, :uchar,
789
+ :default_row_zeroed, :uint8,
763
790
  :default_row_set, :uint8,
791
+ :outline_row_level, :uint8,
792
+ :outline_col_level, :uint8,
793
+
764
794
  :header_footer_changed, :uint8,
765
- :header, [:char, 255],
766
- :footer, [:char, 255],
795
+ :header, :pointer,
796
+ :footer, :pointer,
767
797
  :repeat_rows, RepeatRows.by_value,
768
798
  :repeat_cols, RepeatCols.by_value,
769
799
  :print_area, PrintArea.by_value,
770
800
  :autofilter, Autofilter.by_value,
801
+
771
802
  :merged_range_count, :uint16,
803
+ :max_url_length, :uint16,
804
+
772
805
  :hbreaks, :pointer,
773
806
  :vbreaks, :pointer,
774
807
  :hbreaks_count, :uint16,
775
808
  :vbreaks_count, :uint16,
809
+
810
+ :drawing_rel_id, :uint,
811
+ :vml_drawing_rel_id, :uint,
812
+
776
813
  :external_hyperlinks, :pointer,
777
814
  :external_drawing_links, :pointer,
778
815
  :drawing_links, :pointer,
816
+ :vml_drawing_links, :pointer,
817
+ :external_table_links, :pointer,
818
+
779
819
  :panes, Panes.by_value,
780
- :protection, Protection.by_value,
781
- :drawing, Drawing.ptr,
782
- :list_pointers, WorksheetListPointers.by_value
820
+ :protection, Protection.by_value
821
+ # :drawing, Drawing.ptr,
822
+ # :list_pointers, WorksheetListPointers.by_value
783
823
  end
784
824
 
785
825
  # = Fields:
@@ -990,6 +1030,8 @@ module Libxlsxwriter
990
1030
  # @scope class
991
1031
  attach_function :worksheet_write_string, :worksheet_write_string, [Worksheet, :uint32, :ushort, :string, Format], :error
992
1032
 
1033
+ attach_function :worksheet_write_comment, :worksheet_write_comment, [Worksheet, :uint32, :ushort, :string], :error
1034
+
993
1035
  # @method worksheet_write_formula(worksheet, row, col, formula, format)
994
1036
  # @param [Worksheet] worksheet
995
1037
  # @param [Integer] row
@@ -1514,6 +1556,8 @@ module Libxlsxwriter
1514
1556
  # @scope class
1515
1557
  attach_function :worksheet_find_cell, :lxw_worksheet_find_cell, [Row, :ushort], Cell
1516
1558
 
1559
+ attach_function :worksheet_add_table, :worksheet_add_table, [Worksheet, :uint, :ushort, :uint, :ushort, :pointer], :error
1560
+
1517
1561
  # = Fields:
1518
1562
  # :rbe_left ::
1519
1563
  # (FFI::Pointer(*WorksheetName))
@@ -327,13 +327,13 @@ module Libxlsxwriter
327
327
  :error_zip_internal_error, 8,
328
328
  :error_zip_file_add, 9,
329
329
  :error_zip_close, 10,
330
- :error_null_parameter_ignored, 11,
331
- :error_parameter_validation, 12,
332
- :error_sheetname_length_exceeded, 13,
333
- :error_invalid_sheetname_character, 14,
334
- :error_sheetname_start_end_apostrophe, 15,
335
- :error_sheetname_already_used, 16,
336
- :error_sheetname_reserved, 17,
330
+ :error_feature_not_supported, 11,
331
+ :error_null_parameter_ignored, 12,
332
+ :error_parameter_validation, 13,
333
+ :error_sheetname_length_exceeded, 14,
334
+ :error_invalid_sheetname_character, 15,
335
+ :error_sheetname_start_end_apostrophe, 16,
336
+ :error_sheetname_already_used, 17,
337
337
  :error_32_string_length_exceeded, 18,
338
338
  :error_128_string_length_exceeded, 19,
339
339
  :error_255_string_length_exceeded, 20,
data/lib/fast_excel.rb CHANGED
@@ -36,13 +36,10 @@ module FastExcel
36
36
 
37
37
  filename = filename.to_s if defined?(Pathname) && filename.is_a?(Pathname)
38
38
 
39
- workbook = if constant_memory
40
- opt = Libxlsxwriter::WorkbookOptions.new
41
- opt[:constant_memory] = 1
42
- Libxlsxwriter.workbook_new_opt(filename, opt)
43
- else
44
- Libxlsxwriter.workbook_new(filename)
45
- end
39
+ opt = Libxlsxwriter::WorkbookOptions.new
40
+ opt[:constant_memory] = constant_memory ? 1 : 0
41
+ workbook = Libxlsxwriter.workbook_new_opt(filename, opt)
42
+
46
43
  result = Libxlsxwriter::Workbook.new(workbook)
47
44
 
48
45
  if default_format
@@ -105,23 +102,33 @@ module FastExcel
105
102
  time.to_f / XLSX_DATE_DAY + XLSX_DATE_EPOCH_DIFF + offset / XLSX_DATE_DAY
106
103
  end
107
104
 
108
- def self.print_ffi_obj(value)
109
- puts "#{value.class}"
105
+ def self.print_ffi_obj(value, do_print: true, offset: "", deep: false)
106
+ result = "#{value.class}"
107
+
110
108
  value.members.each do |key|
111
- field_val = if value[key].is_a?(FFI::Pointer) && value[key].null? || value[key].nil?
109
+ fval = value[key]
110
+ field_val = if fval.is_a?(FFI::Pointer) && fval.null? || fval.nil?
112
111
  "nil"
113
- elsif value[key].is_a?(FFI::StructLayout::CharArray)
114
- value[key].to_str.inspect
115
- elsif value[key].is_a?(String)
116
- value[key].inspect
117
- elsif value[key].is_a?(Symbol)
118
- value[key].inspect
112
+ elsif fval.is_a?(FFI::StructLayout::CharArray)
113
+ fval.to_str.inspect
114
+ elsif fval.is_a?(String)
115
+ fval.inspect
116
+ elsif fval.is_a?(Symbol)
117
+ fval.inspect
118
+ elsif fval.is_a?(FFI::Struct) && deep
119
+ print_ffi_obj(fval, do_print: false, offset: offset + " ", deep: deep)
119
120
  else
120
- value[key]
121
+ fval
121
122
  end
122
- puts "* #{key}: #{field_val}"
123
+
124
+ result += "\n#{offset}* #{key}: #{field_val}"
125
+ end
126
+
127
+ if do_print
128
+ puts result
129
+ else
130
+ return result
123
131
  end
124
- nil
125
132
  end
126
133
 
127
134
 
@@ -541,7 +548,7 @@ module FastExcel
541
548
 
542
549
  def close
543
550
  if auto_width?
544
- @column_widths.each do |num, width|
551
+ @column_widths.transform_values!{ |width| width || DEF_COL_WIDTH }.each do |num, width|
545
552
  set_column_width(num, width + 0.2)
546
553
  end
547
554
  end
@@ -0,0 +1 @@
1
+ custom: ["paypal.me/xlsxwriter"]
@@ -0,0 +1,85 @@
1
+ # libxlsxwriter: Reporting Bugs
2
+
3
+ Here are some tips on reporting bugs in `libxlsxwriter`.
4
+
5
+ ### Upgrade to the latest version of the library
6
+
7
+ Upgrade to the latest version of the library since the bug you are reporting
8
+ may already be fixed.
9
+
10
+ Check the [Changes][changes] section of the documentation to see what has
11
+ changed in the latest versions.
12
+
13
+ [changes]: http://libxlsxwriter.github.io/changes.html
14
+
15
+ You can check which version of `libxlsxwriter` that you are using by checking
16
+ the `xlsxwriter.h` header file or by adding the following to your program:
17
+
18
+ ```C
19
+ #include <stdio.h>
20
+ #include "xlsxwriter.h"
21
+
22
+ int main() {
23
+
24
+ printf("Libxlsxwriter version = %s\n", lxw_version());
25
+
26
+ return 0;
27
+ }
28
+ ```
29
+
30
+ ### Read the documentation
31
+
32
+ Read or search the `libxlsxwriter` [documentation][docs] to see if the issue
33
+ you are encountering is already explained.
34
+
35
+ [docs]: http://libxlsxwriter.github.io/index.html
36
+
37
+ ### Look at the example programs
38
+
39
+ There are many [examples programs][examples] in the distribution. Try to
40
+ identify an example program that corresponds to your query and adapt it to use
41
+ as a bug report.
42
+
43
+ [examples]: http://libxlsxwriter.github.io/examples.html
44
+
45
+
46
+ ### Tips for submitting a bug report
47
+
48
+ 1. Describe the problem as clearly and as concisely as possible.
49
+ 2. Include a sample program. This is probably the most important step.
50
+ It is generally easier to describe a problem in code than in written
51
+ prose.
52
+ 3. The sample program should be as small as possible to demonstrate the
53
+ problem. Don't copy and paste large non-relevant sections of your
54
+ program.
55
+
56
+ A sample bug report is shown below. This format helps analyze and respond to
57
+ the bug report more quickly.
58
+
59
+
60
+ > Subject: Issue with SOMETHING
61
+ >
62
+ > Greetings,
63
+ >
64
+ > I am using libxlsxwriter to do SOMETHING but it appears to do SOMETHING ELSE.
65
+ >
66
+ > I am using CC version X.Y.Z, OS = uname and libxlsxwriter x.y.z.
67
+ >
68
+ > Here is some code that demonstrates the problem:
69
+ >
70
+ >
71
+ >```C
72
+ >#include "xlsxwriter.h"
73
+ >
74
+ >int main() {
75
+ >
76
+ > lxw_workbook *workbook = workbook_new("bug_report.xlsx");
77
+ > lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
78
+ >
79
+ > worksheet_write_string(worksheet, 0, 0, "Hello", NULL);
80
+ > worksheet_write_number(worksheet, 1, 0, 123, NULL);
81
+ >
82
+ > return workbook_close(workbook);
83
+ >}
84
+ >```
85
+ >