fast_xlsx 0.5.0-aarch64-linux → 0.6.0-aarch64-linux

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
  SHA256:
3
- metadata.gz: d5ce755a7313239e1f8aed891577dd789243053ba8898298449e6f374f7fa1b0
4
- data.tar.gz: 981326856ac95f0b000f6129608b66f9fd426add3b67693b606442f74e8908d7
3
+ metadata.gz: 86c6c3af8bf6612a6dd0ec0024c601fc4eaa2d2837cb3ddd2a8f051061a98b0d
4
+ data.tar.gz: d5ef7d7f70968e0035cdf0082feffc299c00cb461fbc07fe458d93f279811c70
5
5
  SHA512:
6
- metadata.gz: 2004ba52b608f7ce2ed3bd8d2d2245c77c7967c2160a33b129841004443fadd9ea49b5895683e2d758f3cece3987cc6b5bcc5a768d55fc1a53a4f08623211418
7
- data.tar.gz: 60d511eb64ae1935c8bd04b40961c22b74967f8bac929dea16dc2facd01a4eee5c8c5afedd717c30d61fc328b263ccdc79f7c069d53cb4e32109812871642b29
6
+ metadata.gz: 2136a53ec157e62f1222bf99172efeb27cbbc78730fe5206a8ca531e630868ce6530fb6a35137fc12671629e781f420e89bbc47723eded6128d5184c99a148f9
7
+ data.tar.gz: f81b77ebdd8430e22d92b10477f5b99ae48da3e07ed26d40959b5e2b0b35546cf0ff1fc5aadfb0bc713a064fd39eb31af6e5319c6247b70458cf8435c1bbbcb4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.6.0] - 2026-10-02
4
+
5
+ ### Added
6
+
7
+ - `Worksheet#selection`, `#top_left_cell` (what is selected and scrolled to when the file opens), `#ignore_error` (turns off Excel's green-triangle warnings in a range) and `#unprotect_range` (a range users can edit on a protected sheet).
8
+ - `Worksheet#hide_rows`, `#hide_columns`, `#row_format` (default format for a row's cells) and `#default_row_height` (call it before `row_format`, `hide_rows` and `group_rows`, which copy the default into their rows; it raises otherwise).
9
+
10
+ ### Fixed
11
+
12
+ - `nil` written with a format (e.g. a border, or a row format in `append`) writes a blank cell with that format; the format was dropped.
13
+
3
14
  ## [0.5.0] - 2026-10-01
4
15
 
5
16
  ### Added
data/README.md CHANGED
@@ -101,6 +101,9 @@ ws.zoom(150) # 10..400 percent
101
101
  ws.tab_color("#C00000")
102
102
  ws.hide_gridlines
103
103
  ws.activate # Excel opens on this sheet (un-hides it if hidden)
104
+ ws.selection("B2:C3") # the cells selected when it opens
105
+ ws.top_left_cell("A50") # and the cell scrolled to the top left
106
+ ws.ignore_error("A2:A1000", :number_stored_as_text) # no green triangles (one kind per range; don't overlap ranges)
104
107
  other.hide # the sheet Excel opens on can't be hidden: activate another one first
105
108
 
106
109
  ws.page_setup(landscape: true, paper: :a4, # or :letter, :legal, :tabloid, :a3, :a5, Excel's paper number, 0 = printer default
@@ -130,6 +133,9 @@ Methods that take one cell (`write`, `write_comment`, `insert_image`, `insert_ch
130
133
  ```ruby
131
134
  ws.freeze_panes(1, 0) # keep the first row visible while scrolling
132
135
  ws.row_height(0, 30) # row 1, height in points
136
+ ws.default_row_height(18) # every other row; call it before row_format, hide_rows, group_rows
137
+ ws.row_format(0, header) # default for cells in row 1 written without a format
138
+ ws.hide_rows(10..20) # also hide_columns(3), an index or a Range
133
139
  ws.merge_range(0, 0, 0, 3, "Q3 report", title) # merge A1:D1; the value can be any cell type
134
140
  ws.page_breaks([50, 100]) # print a new page before rows 51 and 101
135
141
  ws.vertical_page_breaks([8]) # and before column I
@@ -164,6 +170,7 @@ input = FastXlsx::Format.new(locked: false)
164
170
  ws.write(1, 1, 0, input) # B2 stays editable
165
171
  ws.protect # lock everything else
166
172
  ws.protect(password: "secret", allow: %i[sort use_autofilter]) # or with a password and allowed actions
173
+ ws.unprotect_range("B2:D10", name: "Inputs") # a range users can still edit (optional password:)
167
174
  ```
168
175
 
169
176
  `allow:` takes `:format_cells`, `:format_columns`, `:format_rows`, `:insert_columns`, `:insert_rows`, `:insert_links`, `:delete_columns`, `:delete_rows`, `:sort`, `:use_autofilter`, `:use_pivot_tables`, `:edit_scenarios`, `:edit_objects`. The password only stops editing in Excel; it does not encrypt the file.
@@ -258,7 +265,7 @@ Values are mapped by type:
258
265
  | `FastXlsx::URL.new("https://…")`, `URL.new(url, text: "Title")` | hyperlink (optionally showing other text) |
259
266
  | `FastXlsx::RichString.new(["Total: ", bold], "1,234")` | text with a format per segment |
260
267
  | `true` / `false` | boolean |
261
- | `nil` | empty cell |
268
+ | `nil` | empty cell (a blank cell with the format, when one is given) |
262
269
  | anything else | `to_s` as string |
263
270
 
264
271
  `<<` and `concat` append after the last row written to that worksheet. In `:constant` / `:low` memory mode rows are written to disk as you go, so fill each worksheet top to bottom.
data/bench/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- fast_xlsx (0.5.0)
4
+ fast_xlsx (0.6.0)
5
5
  rb_sys (~> 0.9.130)
6
6
 
7
7
  GEM
@@ -77,7 +77,7 @@ DEPENDENCIES
77
77
  CHECKSUMS
78
78
  caxlsx (4.5.0) sha256=e3d98d859f148df05d5462086b5079b523f29c1766b569535f1d68629ce743ff
79
79
  fast_excel (0.5.0) sha256=59c418bdcf586a6030798d4e3a9f575742badaceaf7bb90f38eee5feb5bdc478
80
- fast_xlsx (0.5.0)
80
+ fast_xlsx (0.6.0)
81
81
  ffi (1.17.4-aarch64-linux-gnu) sha256=b208f06f91ffd8f5e1193da3cae3d2ccfc27fc36fba577baf698d26d91c080df
82
82
  ffi (1.17.4-aarch64-linux-musl) sha256=9286b7a615f2676245283aef0a0a3b475ae3aae2bb5448baace630bb77b91f39
83
83
  ffi (1.17.4-arm-linux-gnu) sha256=d6dbddf7cb77bf955411af5f187a65b8cd378cb003c15c05697f5feee1cb1564
Binary file
Binary file
Binary file
@@ -2,5 +2,5 @@
2
2
 
3
3
  module FastXlsx
4
4
  # The gem version.
5
- VERSION = "0.5.0"
5
+ VERSION = "0.6.0"
6
6
  end
data/lib/fast_xlsx.rb CHANGED
@@ -226,6 +226,14 @@ module FastXlsx
226
226
  # @param color [String, Integer] "#RRGGBB" or 0xRRGGBB
227
227
  # @return [self]
228
228
  #
229
+ # @!method default_row_height(height)
230
+ # Height of rows not given one with {#row_height}. Call it before
231
+ # {#row_format}, {#hide_rows} and {#group_rows}: rows given those keep
232
+ # the earlier default.
233
+ # @param height [Numeric] points, above 0 and up to 409
234
+ # @return [self]
235
+ # @raise [FastXlsx::Error] when called after those
236
+ #
229
237
  # @!method hide_gridlines
230
238
  # Hides the gridlines on screen (see {#page_setup} for printing).
231
239
  # @return [self]
@@ -441,6 +449,71 @@ module FastXlsx
441
449
  _protect(password, Array(allow))
442
450
  end
443
451
 
452
+ # A range users can still edit on a protected sheet ({#protect}),
453
+ # optionally with its own password. Give each range its own name.
454
+ # @overload unprotect_range(*range, name: nil, password: nil)
455
+ # @param name [String, nil] shown in Excel's "Allow Edit Ranges"
456
+ # @return [self]
457
+ def unprotect_range(*range, name: nil, password: nil)
458
+ _unprotect_range(*CellRange.split(range).first, name, password)
459
+ end
460
+
461
+ # The cells selected when the file opens.
462
+ # @param range a cell range (see {Worksheet})
463
+ # @return [self]
464
+ def selection(*range)
465
+ _selection(*CellRange.split(range).first)
466
+ end
467
+
468
+ # The cell scrolled to the top left when the file opens.
469
+ # @param cell (row, col) or "B2"
470
+ # @return [self]
471
+ def top_left_cell(*cell)
472
+ _top_left_cell(*CellRange.cell(cell).first(2))
473
+ end
474
+
475
+ # Turns off one of Excel's warnings (green triangles) in the range, e.g.
476
+ # for codes stored as text. One kind per range (a rust_xlsxwriter limit);
477
+ # overlapping ranges are accepted, but Excel then uses only one of them.
478
+ # @overload ignore_error(*range, error)
479
+ # @param error [Symbol] :number_stored_as_text, :formula_error,
480
+ # :formula_differs, :formula_refers_to_empty_cells,
481
+ # :formula_omits_cells, :data_validation_error,
482
+ # :unlocked_cells_with_formula, :inconsistent_column_formula
483
+ # @return [self]
484
+ # @raise [FastXlsx::Error] when the range already has one
485
+ def ignore_error(*args)
486
+ range, (error, *) = CellRange.split(args, 1..1)
487
+ _ignore_error(*range, error)
488
+ end
489
+
490
+ # Each row in the range is kept (about 1 KB) until saving.
491
+ # @param rows [Integer, Range<Integer>]
492
+ # @return [self]
493
+ # @raise [FastXlsx::Error] in :constant / :low mode, for rows already on disk
494
+ def hide_rows(rows)
495
+ _hide_rows(*CellRange.bounds(rows))
496
+ end
497
+
498
+ # @param columns [Integer, Range<Integer>]
499
+ # @return [self]
500
+ def hide_columns(columns)
501
+ _hide_columns(*CellRange.bounds(columns))
502
+ end
503
+
504
+ # Default format for cells in these rows that are written without one.
505
+ # Use it or {#column_format} for a cell, not both: where both apply, Excel
506
+ # may combine them or show the row's. Each row is kept (about 1 KB) until
507
+ # saving, so style a whole sheet with {#column_format}.
508
+ # @param rows [Integer, Range<Integer>]
509
+ # @param format [Format]
510
+ # @return [self]
511
+ # @raise [FastXlsx::Error] in :constant / :low mode, for rows already on disk
512
+ def row_format(rows, format)
513
+ _row_format(*CellRange.bounds(rows), format)
514
+ self
515
+ end
516
+
444
517
  # Default format for cells in these columns that are written without one.
445
518
  # @param columns [Integer, Range<Integer>]
446
519
  # @param format [Format]
data/sig/fast_xlsx.rbs CHANGED
@@ -62,6 +62,18 @@ module FastXlsx
62
62
  def <<: (Array[cell] row) -> self
63
63
  def concat: (Array[Array[cell]] rows) -> self
64
64
  def column_width: (Integer | Range[Integer] columns, Numeric width) -> self
65
+ def hide_rows: (Integer | Range[Integer] rows) -> self
66
+ def hide_columns: (Integer | Range[Integer] columns) -> self
67
+ def row_format: (Integer | Range[Integer] rows, Format format) -> self
68
+ def default_row_height: (Numeric height) -> self
69
+ def selection: (*cell_range range) -> self
70
+ def top_left_cell: (Integer row, Integer col) -> self
71
+ | (String cell) -> self
72
+ type ignorable_error = :number_stored_as_text | :formula_error | :formula_differs | :formula_refers_to_empty_cells
73
+ | :formula_omits_cells | :data_validation_error | :unlocked_cells_with_formula
74
+ | :inconsistent_column_formula
75
+ def ignore_error: (*cell_range | ignorable_error args) -> self
76
+ def unprotect_range: (*cell_range range, ?name: String?, ?password: String?) -> self
65
77
  def column_format: (Integer | Range[Integer] columns, Format format) -> self
66
78
  def autofit: () -> self
67
79
  # A cell range: four 0-based numbers, an Excel reference ("A1:D10"), or
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_xlsx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Zac