fast_xlsx 0.4.0 → 0.6.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/.yardopts +7 -0
- data/CHANGELOG.md +22 -0
- data/README.md +25 -4
- data/bench/Gemfile.lock +2 -2
- data/ext/fast_xlsx/src/lib.rs +426 -91
- data/ext/fast_xlsx/tests/ruby_suite.rs +3 -3
- data/lib/fast_xlsx/version.rb +2 -1
- data/lib/fast_xlsx.rb +334 -55
- data/sig/fast_xlsx.rbs +13 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c78ccbcfe82884370ef3e64e4613812a91c521f479495184bd99df1cb7f1d36c
|
|
4
|
+
data.tar.gz: 86702f59f3c33c490ef3879e0178a7bcc9650fdba612bd1cd17ba24662b0392d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 629352aa7bf14685eef2d940f78b23e142f66b946b6d8f2eb36db0bd004574aefb2e04fd29fe2fc42e9684ac5d125725cfea5384d7a439b8f5d361411f68149c
|
|
7
|
+
data.tar.gz: f8755a00230b81f405339f9d123344bf827c3010d80f159c0b5408e2fbcc984d3fd94758fd65e7fa5562d0e8b23825cb0d0b791bf97057db013259afd49c3c96
|
data/.yardopts
ADDED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
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
|
+
|
|
14
|
+
## [0.5.0] - 2026-10-01
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- API documentation: every public method has YARD docs (shown on rubydoc.info).
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Errors follow one rule (see the README): a row or column outside the sheet raises `RangeError` (row 1,048,576, column 16,384 or a row of more than 16,384 cells raised `FastXlsx::Error` or `ArgumentError`); a reversed range or single-cell merge raises `ArgumentError` (was `FastXlsx::Error`); a header or footer over 255 characters raises `FastXlsx::Error` like other text over Excel's limits (was `ArgumentError`); a negative or NaN image size, font size or margin raises `ArgumentError` (was written into the file or ignored); `zoom` converts numbers with `to_int` like other arguments (`zoom(150.9)` raised `TypeError`); `column_width` outside 0..255 and `row_height` outside 0..409 raise `ArgumentError` (a negative one hid the column or row).
|
|
23
|
+
- Date and time cells written with a format that has no `num_format` (e.g. `append(row, format: bold)`) get the default date format added, instead of showing as serial numbers. This applies to a cell's own format, a table column's and `column_format`'s; a format with a `num_format` is used as is.
|
|
24
|
+
|
|
3
25
|
## [0.4.0] - 2026-10-01
|
|
4
26
|
|
|
5
27
|
### Changed
|
data/README.md
CHANGED
|
@@ -82,7 +82,7 @@ ws.write(1, 2, Date.today, date) # format one cell
|
|
|
82
82
|
|
|
83
83
|
Per-side borders override `border`. Unknown options and invalid values raise `ArgumentError`.
|
|
84
84
|
|
|
85
|
-
Dates and times
|
|
85
|
+
Dates and times are shown as `yyyy-mm-dd` or `yyyy-mm-dd hh:mm:ss`. A format without a `num_format` (yours, a table column's or `column_format`'s) keeps its look and gets that date format added, so `append(row, format: bold)` gives bold dates; a format with a `num_format` is used as is.
|
|
86
86
|
|
|
87
87
|
### Columns and filters
|
|
88
88
|
|
|
@@ -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,12 +265,21 @@ 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.
|
|
265
272
|
|
|
266
|
-
Errors
|
|
273
|
+
### Errors
|
|
274
|
+
|
|
275
|
+
| Error | Raised for |
|
|
276
|
+
|---|---|
|
|
277
|
+
| `TypeError` | an argument of the wrong type, e.g. a String where a row number goes |
|
|
278
|
+
| `RangeError` | a row or column outside the sheet (1,048,576 × 16,384), or a negative count (an infinite Float raises `FloatDomainError`, a `RangeError`) |
|
|
279
|
+
| `ArgumentError` | the right type but a value that isn't allowed: an unknown option or symbol, an invalid color or cell reference, a reversed range or single-cell merge, a size or margin that is negative, NaN or beyond Excel's limits |
|
|
280
|
+
| `FastXlsx::Error` | what the workbook can't do: duplicate or invalid names, writing to rows already on disk, overlapping merges, hiding the sheet Excel opens on, text over Excel's limits (cells, URLs, headers and footers), unsupported images |
|
|
281
|
+
|
|
282
|
+
Numbers are converted like Ruby's own methods do (`to_int`), so `1.9` as a row is row `1`.
|
|
267
283
|
|
|
268
284
|
## Performance
|
|
269
285
|
|
|
@@ -323,7 +339,12 @@ BUNDLE_GEMFILE=bench/Gemfile /usr/bin/time -l bundle exec ruby bench/memory.rb f
|
|
|
323
339
|
bundle add fast_xlsx
|
|
324
340
|
```
|
|
325
341
|
|
|
326
|
-
|
|
342
|
+
### Support and versioning
|
|
343
|
+
|
|
344
|
+
- **Ruby:** CRuby 3.3 and later. A Ruby version is dropped only after it reaches its end of life, and only in a minor release. JRuby and TruffleRuby are not supported (this is a native extension).
|
|
345
|
+
- **Precompiled gems:** Linux (x86_64 and aarch64, glibc and musl; ARM musl), macOS (arm64 and x86_64) and Windows (x64). Before each release the Linux x86_64, macOS arm64 and Windows gems are installed and loaded on Ruby 3.3, 3.4 and 4.0. Other platforms build from source and need a Rust toolchain.
|
|
346
|
+
- **Versions:** from 1.0, [Semantic Versioning](https://semver.org): no breaking API change before 2.0. Until then a minor release (0.x.0) can change behaviour; the [changelog](CHANGELOG.md) lists every change under "Changed".
|
|
347
|
+
- **Output:** `.xlsx` files that open in Excel 2007 and later, LibreOffice and Google Sheets. Updating rust_xlsxwriter can change the bytes of the file but not what it contains.
|
|
327
348
|
|
|
328
349
|
## Development
|
|
329
350
|
|
data/bench/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ..
|
|
3
3
|
specs:
|
|
4
|
-
fast_xlsx (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.
|
|
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
|