fast_xlsx 0.8.1-aarch64-linux → 1.1.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: c9165bba88005a3f5650c968193457782c445eec187ae7f78e74a1678aafc3ea
4
- data.tar.gz: 5ab4c7d1cf78c2cb52faa11073b403b4379b81cccc439f00b7fd1d21e54fe179
3
+ metadata.gz: 31cb75bee8ec87dc6827f9767d41a751d80a2563a133b89fde96b0a0c6a6c496
4
+ data.tar.gz: 1b75a423f5ff7997393e12821ba357acddeda10153222d15c107c86937c22f37
5
5
  SHA512:
6
- metadata.gz: f287fe4ee777837267c67fe826eab2baecaacdd1a01c2506e7cde5f2fb59509a64cd526b94feb2e53432cc79b5cda40ac6b1460b2115b4fb1873d52bcdccb6c0
7
- data.tar.gz: 3395da1a56dc85116e5e67cfd4bcf1c72445f041f5d897d00dc022ce214635793d5a0e254202fd8289237a1973a9ace27f57edaac35daa380616a568e12c7e07
6
+ metadata.gz: 68df1c8c147965b4c8e8bec0fe329af086c44abb5b92e1e7c5e51331f654ef67e6184e48f03526e67354b4c0b06750e0bd95b3e3d8fa88b0286f197a0debbf89
7
+ data.tar.gz: 0e1330c30ef203ddee805d98e7213aadd9719e7e56f729d8740358898dd5d5f905ca983727086c5f11693d58ffdca1679f9f2ec4070d3d82e384d492732a3218
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.1.0] - 2026-11-03
4
+
5
+ ### Added
6
+
7
+ - `Worksheet#embed_image` places an image in a cell, where it fits the cell and moves and sizes with it (Excel 365's "Place in Cell"; older Excel shows `#VALUE!`). It takes a path or an IO like `insert_image`, plus `alt_text:` and `format:`. It raises `FastXlsx::Error` in `memory: :constant` and `:low` mode, which rust_xlsxwriter does not support for embedded images.
8
+ - `conditional_format` types `:top` and `:bottom` (`value:` count, or a percentage with `percent: true`), `:average` (`criteria: :above`, `:below`, `:above_or_equal`, `:below_or_equal`, and `std_dev: 1..3`), `:duplicate`, `:unique`, `:blank`, `:not_blank`, `:error`, `:not_error`, and `:date` (`criteria: :yesterday`, `:today`, `:tomorrow`, `:last_7_days`, `:last_week`, `:this_week`, `:next_week`, `:last_month`, `:this_month`, `:next_month`).
9
+ - `conditional_format` type `:icon_set`, with `icons:` (e.g. `:three_arrows`, `:five_boxes`; default `:three_traffic_lights`), `reverse: true` and `icons_only: true`.
10
+ - Custom colors for data bars and color scales: `type: :data_bar, color: "#63BE7B"`, and `type: :color_scale, colors: [min, max]` or `[min, mid, max]`. `colors: 2` and `3` work as before. A data bar's `color:` sets both its fill and its border.
11
+
12
+ ### Deprecated
13
+
14
+ - `colors:` on `conditional_format` `type: :data_bar` was always ignored; it now prints a warning and will raise `ArgumentError` in 2.0. Use `color:` for the bar color.
15
+
16
+ ## [1.0.0] - 2026-10-18
17
+
18
+ The first stable release, with the same API as 0.8.1. From now on fast_xlsx follows Semantic Versioning: no breaking change before 2.0, and anything to be removed first prints a deprecation warning for at least one minor release.
19
+
20
+ ### Fixed
21
+
22
+ - Updated rust_xlsxwriter to 0.100, which brings zip 9.0 (RUSTSEC-2026-0367, -0368 and -0369; those affect extracting archives, which fast_xlsx never does).
23
+ - In `memory: :constant` and `:low` mode, a temporary file that can't be created (e.g. an unwritable temp directory) raises `FastXlsx::Error` instead of crashing the process. The file is also created only when the first row is flushed, not by `add_worksheet`.
24
+
3
25
  ## [0.8.1] - 2026-10-03
4
26
 
5
27
  ### Fixed
data/README.md CHANGED
@@ -1,15 +1,17 @@
1
- # FastXlsx
1
+ # fast_xlsx
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/fast_xlsx.svg)](https://badge.fury.io/rb/fast_xlsx)
3
+ ![fast_xlsx: fast .xlsx writer for Ruby, powered by Rust](docs/social-preview.jpg)
4
+
5
+ [![Gem Version](https://img.shields.io/gem/v/fast_xlsx)](https://rubygems.org/gems/fast_xlsx)
4
6
  [![codecov](https://codecov.io/gh/7a6163/fast_xlsx/graph/badge.svg)](https://codecov.io/gh/7a6163/fast_xlsx)
5
7
 
6
- Fast `.xlsx` writer for Ruby, built on [rust_xlsxwriter](https://github.com/jmcnamara/rust_xlsxwriter) via [magnus](https://github.com/matsadler/magnus).
8
+ Write Excel `.xlsx` files from Ruby with a Rust engine ([rust_xlsxwriter](https://github.com/jmcnamara/rust_xlsxwriter), via [magnus](https://github.com/matsadler/magnus)): 20,000 rows in under 100 ms, with memory that stays flat for large exports.
7
9
 
8
- > **Status: release candidate.** The API is frozen as of 0.8: 0.8.x releases only fix bugs, and 1.0 follows once it has been in real use without needing changes.
10
+ > **Status: stable.** Since 1.0 the API follows [Semantic Versioning](https://semver.org): no breaking change before 2.0.
9
11
 
10
- **Roadmap:** [1.0.0](https://github.com/7a6163/fast_xlsx/milestone/1) (release plan) · [1.x](https://github.com/7a6163/fast_xlsx/milestone/2) (planned features)
12
+ **Roadmap:** [1.x](https://github.com/7a6163/fast_xlsx/milestone/2) (planned features)
11
13
 
12
- **Contents:** [Installation](#installation) · [Getting started](#getting-started) · [Guide](#guide) · [Performance](#performance) · [Support and versioning](#support-and-versioning) · [Development](#development)
14
+ **Contents:** [Installation](#installation) · [Getting started](#getting-started) · [Guide](#guide) · [Performance](#performance) · [Support and versioning](#support-and-versioning) · [Development](#development) · [Credits](#credits)
13
15
 
14
16
  ## Installation
15
17
 
@@ -81,7 +83,7 @@ The [Guide](#guide) below covers every feature; the [API docs](https://www.rubyd
81
83
 
82
84
  ## Guide
83
85
 
84
- [Writing cells](#writing-cells) · [Rails](#rails) · [Memory modes](#memory-modes) · [Formats](#formats) · [Columns and filters](#columns-and-filters) · [Sheet view and printing](#sheet-view-and-printing) · [Cell ranges](#cell-ranges) · [Layout](#layout) · [Outline groups](#outline-groups) · [Defined names](#defined-names) · [Protection](#protection) · [Conditional formats](#conditional-formats) · [Data validation](#data-validation) · [Comments](#comments) · [Images](#images) · [Tables](#tables) · [Charts](#charts) · [Errors](#errors)
86
+ [Writing cells](#writing-cells) · [Rails](#rails) · [Polars](#polars) · [Memory modes](#memory-modes) · [Formats](#formats) · [Columns and filters](#columns-and-filters) · [Sheet view and printing](#sheet-view-and-printing) · [Cell ranges](#cell-ranges) · [Layout](#layout) · [Outline groups](#outline-groups) · [Defined names](#defined-names) · [Protection](#protection) · [Conditional formats](#conditional-formats) · [Data validation](#data-validation) · [Comments](#comments) · [Images](#images) · [Tables](#tables) · [Charts](#charts) · [Errors](#errors)
85
87
 
86
88
  ### Writing cells
87
89
 
@@ -126,6 +128,23 @@ def export
126
128
  end
127
129
  ```
128
130
 
131
+ ### Polars
132
+
133
+ To write a [ruby-polars](https://github.com/ankane/ruby-polars) DataFrame (gem `polars-df`), hand its column names and rows to fast_xlsx:
134
+
135
+ ```ruby
136
+ df = Polars.read_csv("sales.csv")
137
+ summary = df.group_by("region").agg(Polars.col("amount").sum)
138
+
139
+ wb = FastXlsx::Workbook.new(memory: :constant)
140
+ ws = wb.add_worksheet("By region")
141
+ ws.append(summary.columns, format: { bold: true })
142
+ summary.iter_rows { |row| ws << row } # in batches of 512 rows, so memory stays flat
143
+ wb.save("by_region.xlsx")
144
+ ```
145
+
146
+ Polars `Date` and `Datetime` columns become dates (a `Datetime` with a time zone keeps its local time), `Decimal` numbers, and nulls empty cells.
147
+
129
148
  ### Memory modes
130
149
 
131
150
  By default every cell stays in memory until the file is saved. For large exports, two modes write each finished row to a temp file instead:
@@ -235,7 +254,7 @@ ws.autofilter(0..100, 0..3) # rows and columns, each an Integer or a Range
235
254
  ws.merge_range(0, 0..3, "Q3 report", title) # row 1, columns A–D
236
255
  ```
237
256
 
238
- Methods that take one cell (`write`, `write_comment`, `insert_image`, `insert_chart`, `freeze_panes`) take `(row, col)` or a reference like `"B2"`.
257
+ Methods that take one cell (`write`, `write_comment`, `insert_image`, `embed_image`, `insert_chart`, `freeze_panes`) take `(row, col)` or a reference like `"B2"`.
239
258
 
240
259
  `autofit` only sees rows still in memory, so in `:constant` / `:low` memory mode it ignores rows already written to disk; set widths with `column_width` instead.
241
260
 
@@ -296,8 +315,14 @@ ws.conditional_format(0, 1, 99, 1, type: :cell, criteria: :<, value: 0, format:
296
315
  ws.conditional_format(0, 1, 99, 1, type: :cell, criteria: :between, value: [1, 10], format: red)
297
316
  ws.conditional_format(0, 0, 99, 0, type: :text, criteria: :contains, value: "error", format: red)
298
317
  ws.conditional_format(0, 0, 99, 3, type: :formula, value: "=$D1>100", format: red)
299
- ws.conditional_format(0, 2, 99, 2, type: :data_bar)
300
- ws.conditional_format(0, 2, 99, 2, type: :color_scale) # 3-color; colors: 2 for 2-color
318
+ ws.conditional_format(0, 1, 99, 1, type: :top, value: 10, format: red) # or :bottom; percent: true for a %
319
+ ws.conditional_format(0, 1, 99, 1, type: :average, criteria: :below, std_dev: 1, format: red)
320
+ ws.conditional_format(0, 0, 99, 0, type: :duplicate, format: red)
321
+ ws.conditional_format(0, 4, 99, 4, type: :date, criteria: :last_7_days, format: red)
322
+ ws.conditional_format(0, 2, 99, 2, type: :data_bar) # or color: "#63BE7B"
323
+ ws.conditional_format(0, 2, 99, 2, type: :color_scale) # 3-color; colors: 2 for 2-color
324
+ ws.conditional_format(0, 2, 99, 2, type: :color_scale, colors: %w[#F8696B #FFEB84 #63BE7B]) # min, mid, max
325
+ ws.conditional_format(0, 2, 99, 2, type: :icon_set, icons: :three_arrows) # reverse: true, icons_only: true
301
326
  ```
302
327
 
303
328
  | `type` | `criteria` | `value` |
@@ -305,7 +330,14 @@ ws.conditional_format(0, 2, 99, 2, type: :color_scale) # 3-color; col
305
330
  | `:cell` | `:==`, `:!=`, `:>`, `:>=`, `:<`, `:<=`, `:between`, `:not_between` | number or string; `[min, max]` for the range criteria |
306
331
  | `:text` | `:contains`, `:not_contains`, `:begins_with`, `:ends_with` | string |
307
332
  | `:formula` | — | formula string, relative to the top-left cell |
333
+ | `:top`, `:bottom` | — | how many, 1–1000 (default 10); with `percent: true`, a percentage 1–100 |
334
+ | `:average` | `:above` (default), `:below`, `:above_or_equal`, `:below_or_equal`; `std_dev: 1`, `2` or `3` with `:above`/`:below` | — |
335
+ | `:duplicate`, `:unique`, `:blank`, `:not_blank`, `:error`, `:not_error` | — | — |
336
+ | `:date` | `:yesterday`, `:today`, `:tomorrow`, `:last_7_days`, `:last_week`, `:this_week`, `:next_week`, `:last_month`, `:this_month`, `:next_month` | — |
308
337
  | `:data_bar`, `:color_scale` | — | — |
338
+ | `:icon_set` | — | — |
339
+
340
+ Colors are `"#RRGGBB"` or `0xRRGGBB`. `:data_bar` takes `color:`, which sets both the bar's fill and its border; `:color_scale` takes `colors:`, either `2` or `3` or the 2 or 3 colors from minimum to maximum. `:icon_set` takes `icons:` (default `:three_traffic_lights`): `:three_arrows`, `:three_arrows_gray`, `:three_flags`, `:three_traffic_lights`, `:three_traffic_lights_with_rim`, `:three_signs`, `:three_symbols_circled`, `:three_symbols`, `:three_stars`, `:three_triangles`, `:four_arrows`, `:four_arrows_gray`, `:four_red_to_black`, `:four_histograms`, `:four_traffic_lights`, `:five_arrows`, `:five_arrows_gray`, `:five_histograms`, `:five_quadrants`, `:five_boxes`; `reverse: true` reverses their order and `icons_only: true` hides the cell values.
309
341
 
310
342
  ### Data validation
311
343
 
@@ -331,6 +363,7 @@ ws.write_comment(0, 0, "Checked by finance", author: "Zac") # Excel shows it a
331
363
  ws.insert_image(0, 0, "logo.png") # top-left corner in A1
332
364
  ws.insert_image(0, 5, StringIO.new(blob.download), scale: 0.5, x_offset: 10, y_offset: 4, alt_text: "Logo")
333
365
  ws.insert_image(10, 0, "chart.png", width: 320, height: 180) # pixel size; one of them keeps the aspect ratio
366
+ ws.embed_image("B12", "photo.png", alt_text: "Photo", format: { align: :center }) # in the cell, sized with it (Excel 365; not in memory: :constant/:low)
334
367
  ```
335
368
 
336
369
  A String is always treated as a path, so wrap raw bytes (such as Active Storage's `blob.download`) in a `StringIO`.
@@ -402,15 +435,15 @@ Apple Silicon, Ruby 4.0.5. Each library uses its own idiomatic row-append API; x
402
435
 
403
436
  | Library | Time | vs fastest | Ruby objects allocated |
404
437
  |---|---:|---:|---:|
405
- | **fast_xlsx** (`memory: :constant`) | **77 ms** | 1.0x | 7 |
406
- | **fast_xlsx** (`memory: :low`) | **86 ms** | 1.1x | 7 |
407
- | **fast_xlsx** | **89 ms** | 1.1x | 10 |
408
- | [xlsxtream](https://github.com/felixbuenemann/xlsxtream) 3.1 | 183 ms | 2.4x | 561,728 |
409
- | [fast_excel](https://github.com/Paxa/fast_excel) 0.5 (constant_memory) | 200 ms | 2.6x | 20,079 |
410
- | [fast_excel](https://github.com/Paxa/fast_excel) 0.5 | 238 ms | 3.1x | 320,076 |
411
- | [write_xlsx](https://github.com/cxn03651/write_xlsx) 1.15 | 608 ms | 7.8x | 1,483,899 |
412
- | [caxlsx](https://github.com/caxlsx/caxlsx) 4.5 | 689 ms | 8.9x | 745,122 |
413
- | [rubyXL](https://github.com/weshatheleopard/rubyXL) 3.4 | 2755 ms | 35.6x | 8,700,448 |
438
+ | **fast_xlsx** (`memory: :constant`) | **75 ms** | 1.0x | 7 |
439
+ | **fast_xlsx** (`memory: :low`) | **81 ms** | 1.1x | 7 |
440
+ | **fast_xlsx** | **85 ms** | 1.1x | 10 |
441
+ | [xlsxtream](https://github.com/felixbuenemann/xlsxtream) 3.1 | 173 ms | 2.3x | 561,740 |
442
+ | [fast_excel](https://github.com/Paxa/fast_excel) 0.5 (constant_memory) | 204 ms | 2.7x | 20,079 |
443
+ | [fast_excel](https://github.com/Paxa/fast_excel) 0.5 | 238 ms | 3.2x | 320,076 |
444
+ | [write_xlsx](https://github.com/cxn03651/write_xlsx) 1.15 | 592 ms | 7.9x | 1,483,899 |
445
+ | [caxlsx](https://github.com/caxlsx/caxlsx) 4.5 | 671 ms | 8.9x | 745,122 |
446
+ | [rubyXL](https://github.com/weshatheleopard/rubyXL) 3.4 | 2571 ms | 34.1x | 8,700,448 |
414
447
 
415
448
  All outputs are 689–750 KB.
416
449
 
@@ -448,8 +481,8 @@ BUNDLE_GEMFILE=bench/Gemfile /usr/bin/time -l bundle exec ruby bench/memory.rb f
448
481
 
449
482
  - **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).
450
483
  - **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.
451
- - **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".
452
- - **Deprecations:** from 1.0, a method or option to be removed first prints a warning (with `warn`, so on by default) for at least one minor release, with the CHANGELOG naming its replacement; it goes only in the next major version.
484
+ - **Versions:** [Semantic Versioning](https://semver.org) since 1.0: no breaking API change before 2.0. The [changelog](CHANGELOG.md) lists every change.
485
+ - **Deprecations:** a method or option to be removed first prints a warning (with `warn`, so on by default) for at least one minor release, with the CHANGELOG naming its replacement; it goes only in the next major version.
453
486
  - **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.
454
487
 
455
488
  ## Development
@@ -498,6 +531,10 @@ git tag v0.1.0 && git push origin v0.1.0
498
531
 
499
532
  The `Build gems` workflow builds the source gem plus precompiled gems for each platform and pushes them to RubyGems (trusted publishing) and GitHub Packages. It refuses to publish if the tag and `VERSION` differ.
500
533
 
534
+ ## Credits
535
+
536
+ Inspired by [fast_excel](https://github.com/Paxa/fast_excel), whose API and approach fast_xlsx builds on, and made possible by [rust_xlsxwriter](https://github.com/jmcnamara/rust_xlsxwriter) and [magnus](https://github.com/matsadler/magnus).
537
+
501
538
  ## License
502
539
 
503
540
  MIT
data/SECURITY.md ADDED
@@ -0,0 +1,26 @@
1
+ # Security policy
2
+
3
+ ## Supported versions
4
+
5
+ Security fixes go into the latest release of the newest minor version. Until 1.0 that is 0.8.x; from 1.0, the latest 1.x.
6
+
7
+ | Version | Supported |
8
+ |---|---|
9
+ | 0.8.x | ✅ |
10
+ | < 0.8 | ❌ (upgrade to 0.8.x; the [changelog](CHANGELOG.md) lists every change) |
11
+
12
+ ## Reporting a vulnerability
13
+
14
+ Please don't open a public issue. Report it privately through GitHub: on the repository's **Security** tab, choose **Report a vulnerability** ([direct link](https://github.com/7a6163/fast_xlsx/security/advisories/new)).
15
+
16
+ Include what an attacker could do, the fast_xlsx, Ruby and platform versions, and a script or input that shows it, if you have one.
17
+
18
+ What to expect:
19
+
20
+ - An acknowledgement within a week.
21
+ - A fix in a patch release, and a GitHub security advisory crediting you (unless you'd rather not be named), once users can upgrade.
22
+ - If it turns out to be in a dependency (rust_xlsxwriter, magnus, rb-sys, the Rust zip crates), a report to that project as well.
23
+
24
+ ## Scope
25
+
26
+ fast_xlsx only writes `.xlsx` files: it doesn't read or parse spreadsheets. Issues of interest include memory-safety bugs in the native extension (a crash or corruption reachable from Ruby), and output that makes Excel or other readers misbehave from data an application would reasonably pass in (cell text, formulas, URLs, images). Formulas and hyperlinks are written as given: an application writing untrusted input as a `FastXlsx::Formula` or `FastXlsx::URL` should validate it first, as with CSV formula injection.
@@ -4,7 +4,7 @@ fast_xlsx started as a rewrite of [fast_excel](https://github.com/Paxa/fast_exce
4
4
 
5
5
  **Why switch**
6
6
 
7
- - 2.8–3.3× faster on the [README benchmark](../README.md#speed), and `memory: :constant` adds about 1 MB however large the file.
7
+ - Faster writing (see the [README benchmark](../README.md#speed)), and `memory: :constant` adds about 1 MB however large the file.
8
8
  - Precompiled gems for Linux, macOS and Windows: no C compiler or FFI at install.
9
9
  - Dates show as dates without a format, every option is checked (a typo raises instead of being ignored), and saving doesn't block other threads.
10
10
  - Conditional formats, data validation, tables, charts, images, comments, protection and printing options as Ruby methods.
Binary file
Binary file
Binary file
@@ -2,5 +2,5 @@
2
2
 
3
3
  module FastXlsx
4
4
  # The gem version.
5
- VERSION = "0.8.1"
5
+ VERSION = "1.1.0"
6
6
  end
data/lib/fast_xlsx.rb CHANGED
@@ -269,6 +269,13 @@ module FastXlsx
269
269
  end
270
270
  private :_write_ref
271
271
 
272
+ # [row, col, image bytes] from insert_image's and embed_image's (*cell, source).
273
+ def image_args(args)
274
+ row, col, (source, *) = CellRange.cell(args, 1..1)
275
+ [row, col, source.respond_to?(:read) ? source.read : File.binread(source)]
276
+ end
277
+ private :image_args
278
+
272
279
  # Writes one cell: ws["B2"] = 42 or ws[1, 1] = 42. Use {#write} to give
273
280
  # it a format.
274
281
  # @overload []=(ref, value)
@@ -330,14 +337,30 @@ module FastXlsx
330
337
  # Highlights cells in the range by rule; see the README for each type's
331
338
  # options.
332
339
  # @param range a cell range (see {Worksheet})
333
- # @param type [Symbol] :cell, :text, :formula, :data_bar or :color_scale
334
- # @option options [Symbol] :criteria e.g. :>, :between, :contains
335
- # @option options [Numeric, String, Array] :value
340
+ # @param type [Symbol] :cell, :text, :formula, :top, :bottom, :average,
341
+ # :duplicate, :unique, :blank, :not_blank, :error, :not_error, :date,
342
+ # :data_bar, :color_scale or :icon_set
343
+ # @option options [Symbol] :criteria e.g. :>, :between, :contains,
344
+ # :below (:average), :last_7_days (:date)
345
+ # @option options [Numeric, String, Array] :value (:top and :bottom: how many, default 10)
336
346
  # @option options [Format, Hash] :format
337
- # @option options [Integer] :colors 2 or 3 (:color_scale)
347
+ # @option options [Boolean] :percent value is a percentage (:top, :bottom)
348
+ # @option options [Integer] :std_dev 1, 2 or 3 standard deviations (:average)
349
+ # @option options [Integer, Array] :colors 2 or 3, or the 2 or 3 colors
350
+ # ("#RRGGBB" or 0xRRGGBB) from minimum to maximum (:color_scale)
351
+ # @option options [String, Integer] :color bar fill and border color,
352
+ # "#RRGGBB" or 0xRRGGBB (:data_bar)
353
+ # @option options [Symbol] :icons e.g. :three_arrows, :five_boxes; default
354
+ # :three_traffic_lights (:icon_set)
355
+ # @option options [Boolean] :reverse reverse the order of the icons (:icon_set)
356
+ # @option options [Boolean] :icons_only hide the cell values (:icon_set)
338
357
  # @return [self]
339
358
  def conditional_format(*range, type:, **options)
340
359
  options[:format] = Format._coerce(options[:format]) if options.key?(:format)
360
+ if type == :data_bar && options.key?(:colors)
361
+ warn "fast_xlsx: colors: is ignored on :data_bar and will raise in 2.0; use color:", uplevel: 1
362
+ options.delete(:colors)
363
+ end
341
364
  _conditional_format(*CellRange.split(range).first, { type: type, **options })
342
365
  end
343
366
 
@@ -370,9 +393,20 @@ module FastXlsx
370
393
  # @return [self]
371
394
  # @raise [FastXlsx::Error] for data that isn't a supported image
372
395
  def insert_image(*args, **)
373
- row, col, (source, *) = CellRange.cell(args, 1..1)
374
- bytes = source.respond_to?(:read) ? source.read : File.binread(source)
375
- _insert_image(row, col, bytes, { ** })
396
+ _insert_image(*image_args(args), { ** })
397
+ end
398
+
399
+ # Embeds a PNG, JPEG, GIF or BMP image in the cell, where it fits the cell
400
+ # and moves and sizes with it (Excel 365's "Place in Cell"; older Excel
401
+ # shows #VALUE!). Not available in memory: :constant or :low mode.
402
+ # @overload embed_image(*cell, source, alt_text: nil, format: nil)
403
+ # @param source [String, #read] a file path or an IO
404
+ # @param alt_text [String, nil]
405
+ # @param format [Format, Hash, nil] the cell's format, e.g. to center the image
406
+ # @return [self]
407
+ # @raise [FastXlsx::Error] for data that isn't a supported image, or in those modes
408
+ def embed_image(*args, alt_text: nil, format: nil)
409
+ _embed_image(*image_args(args), alt_text, Format._coerce(format))
376
410
  end
377
411
 
378
412
  # Inserts a chart with its top-left corner in the cell.
data/sig/fast_xlsx.rbs CHANGED
@@ -124,9 +124,18 @@ module FastXlsx
124
124
  | (indexes rows, indexes cols, cell value, ?format? format) -> self
125
125
  | (*cell_range | cell args, format: format?) -> self
126
126
  def conditional_format: (*cell_range range,
127
- type: :cell | :text | :formula | :data_bar | :color_scale,
127
+ type: :cell | :text | :formula | :top | :bottom | :average | :duplicate | :unique
128
+ | :blank | :not_blank | :error | :not_error | :date | :data_bar | :color_scale
129
+ | :icon_set,
128
130
  ?criteria: Symbol, ?value: Numeric | String | Array[Numeric | String],
129
- ?format: format, ?colors: 2 | 3) -> self
131
+ ?format: format, ?percent: bool, ?std_dev: 1 | 2 | 3,
132
+ ?colors: 2 | 3 | Array[Format::color], ?color: Format::color,
133
+ ?icons: icon_type, ?reverse: bool, ?icons_only: bool) -> self
134
+ type icon_type = :three_arrows | :three_arrows_gray | :three_flags | :three_traffic_lights
135
+ | :three_traffic_lights_with_rim | :three_signs | :three_symbols_circled | :three_symbols
136
+ | :three_stars | :three_triangles | :four_arrows | :four_arrows_gray | :four_red_to_black
137
+ | :four_histograms | :four_traffic_lights | :five_arrows | :five_arrows_gray
138
+ | :five_histograms | :five_quadrants | :five_boxes
130
139
  def data_validation: (*cell_range range,
131
140
  type: :list | :whole_number | :decimal | :text_length,
132
141
  ?criteria: Symbol, ?value: Numeric | String | Array[Numeric | String],
@@ -138,6 +147,8 @@ module FastXlsx
138
147
  ?x_offset: Integer, ?y_offset: Integer, ?alt_text: String) -> self
139
148
  | (String cell, String | _Reader source, ?scale: Numeric, ?width: Numeric, ?height: Numeric,
140
149
  ?x_offset: Integer, ?y_offset: Integer, ?alt_text: String) -> self
150
+ def embed_image: (Integer row, Integer col, String | _Reader source, ?alt_text: String?, ?format: format?) -> self
151
+ | (String cell, String | _Reader source, ?alt_text: String?, ?format: format?) -> self
141
152
  type chart_series = { values: String, ?categories: String, ?name: String }
142
153
 
143
154
  def insert_chart: (Integer row, Integer col, type: Symbol, series: Array[chart_series],
metadata CHANGED
@@ -1,17 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_xlsx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 1.1.0
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Zac
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-02 00:00:00.000000000 Z
11
+ date: 2026-11-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Writes Excel .xlsx files from Ruby through a native Rust extension (rust_xlsxwriter
14
- + magnus).
13
+ description: 'Writes Excel .xlsx files from Ruby through a native Rust extension (rust_xlsxwriter):
14
+ 20,000 rows in under 100 ms, and memory that stays flat for large exports. Formats,
15
+ formulas, tables, charts, conditional formats, data validation and more.'
15
16
  email:
16
17
  - 579103+7a6163@users.noreply.github.com
17
18
  executables: []
@@ -24,6 +25,7 @@ files:
24
25
  - LICENSE.txt
25
26
  - README.md
26
27
  - Rakefile
28
+ - SECURITY.md
27
29
  - bench/Gemfile
28
30
  - bench/Gemfile.lock
29
31
  - bench/compare.rb
@@ -68,5 +70,5 @@ requirements: []
68
70
  rubygems_version: 3.5.23
69
71
  signing_key:
70
72
  specification_version: 4
71
- summary: Fast xlsx writer for Ruby, powered by rust_xlsxwriter
73
+ summary: Excel .xlsx writer for Ruby with a Rust engine
72
74
  test_files: []