xlsxrb 0.1.18 → 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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +200 -0
  3. data/README.md +35 -12
  4. data/lib/ruby_lsp/xlsxrb/completion_listener.rb +410 -80
  5. data/lib/xlsxrb/chart_builder.rb +251 -386
  6. data/lib/xlsxrb/dsl_helpers.rb +169 -68
  7. data/lib/xlsxrb/elements/cell.rb +37 -157
  8. data/lib/xlsxrb/elements/column.rb +11 -19
  9. data/lib/xlsxrb/elements/coordinate_access.rb +15 -86
  10. data/lib/xlsxrb/elements/image.rb +5 -72
  11. data/lib/xlsxrb/elements/metadata.rb +463 -817
  12. data/lib/xlsxrb/elements/row.rb +27 -145
  13. data/lib/xlsxrb/elements/styles.rb +30 -88
  14. data/lib/xlsxrb/elements/types.rb +6 -99
  15. data/lib/xlsxrb/elements/workbook.rb +19 -126
  16. data/lib/xlsxrb/elements/worksheet.rb +45 -316
  17. data/lib/xlsxrb/ooxml/reader/listeners/core_listeners.rb +4 -1
  18. data/lib/xlsxrb/ooxml/reader/listeners/drawing_listeners.rb +7 -7
  19. data/lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb +32 -17
  20. data/lib/xlsxrb/ooxml/reader.rb +49 -51
  21. data/lib/xlsxrb/ooxml/styles_parser.rb +26 -2
  22. data/lib/xlsxrb/ooxml/utils.rb +15 -2
  23. data/lib/xlsxrb/ooxml/workbook_parser.rb +0 -1
  24. data/lib/xlsxrb/ooxml/workbook_writer.rb +184 -94
  25. data/lib/xlsxrb/ooxml/worksheet_parser.rb +61 -29
  26. data/lib/xlsxrb/ooxml/worksheet_writer.rb +353 -261
  27. data/lib/xlsxrb/ooxml/writer/drawing_xml.rb +28 -11
  28. data/lib/xlsxrb/ooxml/writer/features_xml.rb +62 -16
  29. data/lib/xlsxrb/ooxml/writer/styles_xml.rb +1 -1
  30. data/lib/xlsxrb/ooxml/writer.rb +106 -42
  31. data/lib/xlsxrb/ooxml/xml_builder.rb +18 -0
  32. data/lib/xlsxrb/ooxml/xml_parser.rb +78 -5
  33. data/lib/xlsxrb/ooxml/zip_reader.rb +65 -15
  34. data/lib/xlsxrb/ooxml/zip_writer.rb +119 -30
  35. data/lib/xlsxrb/stream_row.rb +14 -118
  36. data/lib/xlsxrb/stream_sheet.rb +14 -261
  37. data/lib/xlsxrb/stream_writer.rb +807 -1537
  38. data/lib/xlsxrb/style_builder.rb +715 -593
  39. data/lib/xlsxrb/version.rb +1 -1
  40. data/lib/xlsxrb/workbook_builder.rb +403 -286
  41. data/lib/xlsxrb/worksheet_builder.rb +1297 -1458
  42. data/lib/xlsxrb.rb +281 -1079
  43. data/sig/generated/xlsxrb/chart_builder.rbs +202 -205
  44. data/sig/generated/xlsxrb/dsl_helpers.rbs +92 -16
  45. data/sig/generated/xlsxrb/elements/cell.rbs +12 -76
  46. data/sig/generated/xlsxrb/elements/column.rbs +0 -7
  47. data/sig/generated/xlsxrb/elements/coordinate_access.rbs +5 -41
  48. data/sig/generated/xlsxrb/elements/image.rbs +3 -29
  49. data/sig/generated/xlsxrb/elements/metadata.rbs +138 -151
  50. data/sig/generated/xlsxrb/elements/row.rbs +10 -53
  51. data/sig/generated/xlsxrb/elements/styles.rbs +1 -39
  52. data/sig/generated/xlsxrb/elements/workbook.rbs +14 -78
  53. data/sig/generated/xlsxrb/elements/worksheet.rbs +5 -121
  54. data/sig/generated/xlsxrb/ooxml/reader/listeners/feature_listeners.rbs +0 -4
  55. data/sig/generated/xlsxrb/ooxml/reader.rbs +0 -3
  56. data/sig/generated/xlsxrb/ooxml/styles_parser.rbs +1 -1
  57. data/sig/generated/xlsxrb/ooxml/utils.rbs +13 -3
  58. data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +17 -0
  59. data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +16 -0
  60. data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +58 -3
  61. data/sig/generated/xlsxrb/ooxml/writer/features_xml.rbs +10 -0
  62. data/sig/generated/xlsxrb/ooxml/writer.rbs +20 -14
  63. data/sig/generated/xlsxrb/ooxml/xml_builder.rbs +12 -0
  64. data/sig/generated/xlsxrb/ooxml/xml_parser.rbs +70 -0
  65. data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +22 -7
  66. data/sig/generated/xlsxrb/ooxml/zip_writer.rbs +26 -1
  67. data/sig/generated/xlsxrb/stream_row.rbs +9 -44
  68. data/sig/generated/xlsxrb/stream_sheet.rbs +1 -158
  69. data/sig/generated/xlsxrb/stream_writer.rbs +491 -974
  70. data/sig/generated/xlsxrb/style_builder.rbs +464 -239
  71. data/sig/generated/xlsxrb/workbook_builder.rbs +124 -139
  72. data/sig/generated/xlsxrb/worksheet_builder.rbs +922 -686
  73. data/sig/generated/xlsxrb.rbs +56 -188
  74. data/sig/rexml.rbs +8 -0
  75. metadata +3 -5
  76. data/lib/xlsxrb/utils.rb +0 -251
  77. data/sig/generated/xlsxrb/utils.rbs +0 -200
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f63edc4ff06e7c40608175b89fbcb822f121bae1b485ea689885540806498bec
4
- data.tar.gz: c26a8000287eb1ff23ffc6987be404dbc7a34ea1f634b3d063faac6481a57e81
3
+ metadata.gz: 6eed4936f201a7a8a3090b4d1ca8cb4609992b663565f94cb66e62137adc1def
4
+ data.tar.gz: 733afe59d5c49dddcc508fb4fe8db66e2c41bec971c7a057debebd2b5f6c9dbd
5
5
  SHA512:
6
- metadata.gz: a7980f5301fe23f6bc7577447d8d924ab6c17f2ad5f5849e9023b95cb74ac86a15d9c61d9113bbb7b4c517a8961a14e3f7c4b96e533f4e8fb6010897f21b5bed
7
- data.tar.gz: cbf3e1bdee2d617da99c32c7a5ad8e4acb4d6cd81d6cc662b6d4d46783dd0592185c142d7a4d26ca0300b66478d93780e2fde45f6ad5e29deaec80910338e245
6
+ metadata.gz: 31a5bc6068cf43cc0d878cc3232cecfcab8e4669e2a36435752ec212ba70a204813f0e1b216817e81397f5ed5f56973f9a1ea8e2a91c5b6bcbcb61141bf11482
7
+ data.tar.gz: 9e1614094509557f10679da61b2fc58b2abf21f2853472479ce424adc35da304e509a1094144cb1b8c28d8ca40b3e1da031a290fa594bd04042120c9cf59e9e9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,203 @@
1
+ ## [0.2.1] - 2026-11-16
2
+
3
+ ### Changed
4
+ - Write styled cells faster in `Xlsxrb.write` with a block (`StreamWriter`). Writing 50,000 rows of 10 cells with every cell styled takes longer than writing them unstyled by 48% with a `row_style` (0.2.0: 131%), 45% with one `cell_styles` name (148%), 89% with a per-column `cell_styles` array (217%), and 45% with column styles (198%), on Ruby 4.0 without YJIT. With YJIT the differences are 49%, 49%, 76%, and 35% (120%, 142%, 195%, and 223%). Each figure is the fastest of three processes that each run one case seven times and take the median. The written files are unchanged.
5
+ - Build and write styled cells faster with `Xlsxrb.build` and `Xlsxrb.write(target, workbook)`. Building and writing the same rows with every cell styled takes longer than unstyled rows by 4% with a `row_style` (0.2.0: 40%), 13% with one `cell_styles` name (41%), 20% with a per-column `cell_styles` array (44%), and 7% with column styles (40%), on Ruby 4.0 without YJIT. With YJIT the differences are 18%, 20%, 41%, and 25% (46%, 46%, 41%, and 49%). Unstyled rows also build and write in 25% less time than in 0.2.0, and 37% less with YJIT. `Xlsxrb.build` creates each cell once, with its style index, instead of creating it with the style name first. The built workbooks and written files are unchanged.
6
+ - `WorkbookBuilder#sheet` and `WorkbookBuilder#[]` return a `DeferredWorksheet` instead of an `Elements::Worksheet`. It answers the same methods with the same results, and builds the worksheet the first time one of them is called or when it is frozen. `is_a?(Elements::Worksheet)` is false for it, and its RBS type changed. This breaks the rule that patch releases keep public APIs compatible; it is made in 0.2.1 as an exception, because returning a built worksheet would create every cell of the sheet twice.
7
+ - `WorksheetBuilder#row`, `#<<`, `#skip_rows`, and `#group_rows` with row indexes raise `Xlsxrb::Error` after the sheet's block ends, instead of ignoring the rows.
8
+
9
+ ### Deprecated
10
+ - Using the sheet that `WorkbookBuilder#sheet` and `WorkbookBuilder#[]` return (`DeferredWorksheet`) is deprecated and warns on first use; read sheets from the workbook that `Xlsxrb.build` returns. In version 0.3.0, `WorkbookBuilder#sheet` will return the sheet's `WorksheetBuilder`, and `WorkbookBuilder#[]` will return the `WorksheetBuilder` of an existing sheet ([ADR 0010](docs/adr/0010-one-dsl-for-built-and-streamed-workbooks.md)).
11
+ - Adding a sheet with `WorkbookBuilder#[]` is deprecated and warns when the call is given a name or an index, or no argument after a sheet was added; use `WorkbookBuilder#sheet`. In version 0.3.0, `#[]` will look sheets up as `StreamWriter#[]` does: it will return the `WorksheetBuilder` of an existing sheet, or of the current sheet without an argument, and raise for a sheet that does not exist. `w[0]` now adds a sheet named `"0"`.
12
+ - Using the value that `style` returns, on `Xlsxrb.build` and `Xlsxrb.write` writers and their sheets, is deprecated and warns on first use; configure the style with options or in the block given to `style`. In version 0.3.0, `style` will return `nil`. The returned value (`ReturnedStyleBuilder`) still changes the style. Changing a style after cells use it styles those cells differently in `Xlsxrb.build` and `StreamWriter`.
13
+ - Changing a sheet setting that `StreamWriter` writes at the start of the sheet after rows of the sheet are written is deprecated and warns: `column`, `freeze_pane`, `split_pane`, `selection`, `sheet_view`, `sheet_format`, `sheet_properties`, `outline_properties`, `tab_color=`, `code_name=`, `fit_to_page=`, and `page_setup` with `fit_to_width` or `fit_to_height`. Make these settings before the first row. Such a setting applies only while the first rows are held back, and is dropped without an error once about 64 KB of rows are written. In version 0.3.0, it will raise `Xlsxrb::Error`.
14
+ - Looking up a sheet that does not exist with `StreamWriter#[]` is deprecated and warns; create sheets with `StreamWriter#sheet`. In version 0.3.0, it will raise `ArgumentError`. Writing to such a sheet already raises `Xlsxrb::Error`.
15
+ - In version 0.3.0, `StreamWriter#sheet` will return the sheet's writer (`WorksheetProxy`) instead of its name, as `WorkbookBuilder#sheet` will return the sheet's `WorksheetBuilder`. A return value cannot be checked when it is used, so this does not warn. Code that looks the sheet up by the returned name, as in `w[w.sheet("A")]`, can use the returned writer instead.
16
+ - `WorksheetBuilder#build` is deprecated and warns; it will be private in version 0.3.0.
17
+ - In version 0.3.0, cells built by `Xlsxrb.build` will change as follows. `Cell#format_code` will be the number format of the cell's resolved style, as in a loaded workbook; it is now set only for styles defined on the sheet with a String name, and only as the format was when the row was added. Cells styled `:default` or `:none` will have style index 0 instead of the name. A style index given in `cell_styles` will be kept only in `Cell#style_index`, not also in `Cell#style`.
18
+
19
+ ### Fixed
20
+ - Count cell text and sheet names in UTF-16 code units for Excel's limits (32,767 and 31), as Excel does ([ADR 0011](docs/adr/0011-count-excel-text-limits-as-excel-does.md)). Characters outside the Basic Multilingual Plane, such as emoji, count as two. Counting Unicode characters let `strict_excel_mode` write files that Excel repairs, such as a cell with 16,384 emoji or a sheet name with 16. `Elements::Worksheet.valid_name?` and `validate` count the same way, and `DslHelpers.sanitize_sheet_name` cuts a name to 31 code units without splitting a character.
21
+ - Raise `ArgumentError` for cell text longer than 32,767 characters in `StreamWriter` with `strict_excel_mode` (the default), as `Xlsxrb.build` does. The check never ran, so such text was written and Excel cut it when repairing the file. With `strict_excel_mode: false` it is written as before.
22
+ - Write cell text that looks like an `_xHHHH_` escape, and characters that XML 1.0 cannot hold, so that Excel and `Xlsxrb.load` read the text back as written, in all writers. `"_x0041_"` was read back as `"A"`, because the leading underscore was not written as `_x005F_`, and characters such as U+0001 and U+FFFE were dropped; they are now written as `_x0001_` and `_xFFFE_`. Shared strings, inline strings, rich text runs, and cached formula strings are encoded this way (ECMA-376 `ST_Xstring`).
23
+ - Return `nil` from `row`, `skip_rows`, and `group_rows` in `Xlsxrb.build` and `StreamWriter` sheets, as documented. `Xlsxrb.build` returned its internal list of rows from `row`, and both modes returned the next row index from `skip_rows` and the block's value or the row indexes from `group_rows`.
24
+ - Report a sheet that was never created when writing to it through `StreamWriter#[]`. The error said that the sheet was no longer active, as for an earlier sheet.
25
+ - Write negative integers with their value in `StreamWriter` rows that have a row style, height, or other row attribute, or in sheets with column styles. Unstyled cells in such rows took the value from a lookup table indexed from its end, so `-1` was written as `65535`.
26
+ - Give `Date` and `Time` cells without a cell style the default date and date-time number formats in `StreamWriter` rows that have a row style, height, or other row attribute, and in sheets with column styles ([#9](https://github.com/niku/xlsxrb/issues/9)). A cell that inherits a row or column style without a number format gets a variant of that style with the date format, as a cell style already did, so it keeps the style's font, fill, and border. These cells were written without a number format, so Excel showed the serial number.
27
+ - Write values that claim to be a `Time` through `is_a?` without being one, such as `ActiveSupport::TimeWithZone`, as date-times with their own wall clock, in `Xlsxrb.build` and `StreamWriter`. `case`/`when` did not match them as `Time`, so they were written as text inside a number cell, which Excel repairs. `Xlsxrb.build` keeps them as `Time` values with the same wall clock.
28
+ - Give `Date` and `Time` cells without a cell style, in `Xlsxrb.build` rows that have a row style or in sheets with column styles, a variant of the inherited style with the default date or date-time format, as `StreamWriter` does. These cells were given the default format alone, so they lost the row or column style's font, fill, and border.
29
+ - Leave the `cell_styles` Array given to `WorksheetBuilder#row` in `Xlsxrb.build` unchanged. A `Date` or `Time` cell without a style wrote the default date style into the caller's Array, so the next row given the same Array got that date style in the same column.
30
+ - Keep the threaded comments of styled cells in the workbook that `Xlsxrb.build` returns. Those cells lost `Cell#threaded_comments` when their style names were resolved. Written files were not affected, because threaded comments are written from the sheet's list.
31
+ - Raise `ArgumentError` when a Hash given to `cell_styles:` has a style option as a key or a value that is not a style, as in `cell_styles: { bold: true }`. Such a Hash maps columns to styles, so `{ bold: true }` was read as column BOLD and failed with a column-limit error, and `{ b: true }` was ignored. The message shows how to give inline styles.
32
+ - Give `Date` and `Time` cells in `StreamWriter` rows the date variant of their style's current definition. After a style was defined again with `style`, its date cells kept the variant made from the earlier definition.
33
+ - Style the cells of `Xlsxrb.build` with the definition a style had when each row, or column style, was added, as `StreamWriter` does. A style defined again later, in the workbook or in any sheet, changed the cells of every sheet, including rows added before it. A style used before any definition still takes its first definition.
34
+ - Write the Playground `quick_start`, `sales_report`, and `sheet_properties` preset formulas with `s.formula(...)`. Since 0.2.0 plain strings starting with `=` are written as text, so these presets showed `=D12` and similar strings instead of computed values.
35
+ - Write the formulas in the Visual Gallery `sheet_properties` example with `s.formula(...)`, so its second sheet shows computed totals instead of `=SUM(...)` text.
36
+ - Render Japanese text in the Playground's LibreOffice preview. The ZetaOffice build ships no CJK font, so Japanese characters showed as boxes, including in the `japanese_text` preset. `rake fetch_assets` now downloads Noto Sans JP Regular and Bold (SIL Open Font License 1.1, license published next to the fonts), and the Playground installs them before LibreOffice starts.
37
+
38
+ ## [0.2.0] - 2026-11-10
39
+
40
+ Upgrading from 0.1.x: see [docs/UPGRADING-0.2.md](docs/UPGRADING-0.2.md).
41
+
42
+ ### Added
43
+ - Add `show_sheet_tabs?`, `full_calc_on_load?`, and `refresh_all?` boolean predicates on `Elements::WorkbookProperties`.
44
+ - Add `core_properties=` and `app_properties=` assignment setters on `WorkbookBuilder`, `StreamWriter`, and `StreamWriter::WorksheetProxy`.
45
+ - Add `name` reader on `StreamWriter::WorksheetProxy` to mirror `WorksheetBuilder#name`.
46
+ - Value object delegators (`formula`, `array_formula`, `shared_formula`, `rich_text`, `hyperlink`, `comment`, `cell_error`) on `WorkbookBuilder`, and (`formula`, `array_formula`, `shared_formula`, `rich_text`, `cell_error`) on `WorksheetBuilder`, `StreamWriter`, and `StreamWriter::WorksheetProxy`.
47
+ - Expose `:style_index` as a canonical `Data.define` member on `Elements::Row`.
48
+ - Add `columns` 0-argument reader on `WorksheetBuilder`, `StreamWriter`, and `StreamWriter::WorksheetProxy` returning an array of `Elements::Column`, and on `TableBuilder` returning an array of `Elements::TableColumn`.
49
+ - Add `sheet_protection=` assignment setter on `WorksheetBuilder`, `StreamWriter`, and `WorksheetProxy` accepting `Elements::SheetProtection`, `Hash`, `Boolean`, or `nil`.
50
+ - Add `print_titles=` assignment setter on `WorksheetBuilder`, `WorkbookBuilder`, `StreamWriter`, and `WorksheetProxy` accepting `Elements::PrintTitles`, `Hash`, or `nil`.
51
+ - Add value object members for data that the reader already parsed but the value objects dropped: `CoreProperties#language`, `WorkbookProperties#update_links`, `WorkbookProtection#revisions_algorithm_name`, `#revisions_hash_value`, `#revisions_salt_value`, and `#revisions_spin_count`, `PageSetup#page_order`, `#horizontal_dpi`, and `#vertical_dpi`, `TableColumn#data_cell_style`, `Font#vert_align`, `ThreadedComment#provider_id`, and `FilterColumn#blank` and `#custom_filters_and`.
52
+ - Add `Elements::FilterColumn.from_spec(column_id, spec)` and `FilterColumn#to_spec` to convert between filter column value objects and the `filter_column` hash format (`type: :filters`, `:custom`, `:dynamic`, `:top10`, `:color_filter`, or `:icon_filter`).
53
+
54
+ ### Changed
55
+ - Unify property configuration methods across `WorksheetBuilder`, `WorkbookBuilder`, `StreamWriter`, and `WorksheetProxy` (`sheet_properties`, `sheet_view`, `sheet_format`, `print_options`, `workbook_properties`, `core_properties`, `app_properties`) to pure 0-argument getters returning value objects/hashes and keyword argument mutators returning `void` (`nil`).
56
+ - Unify single-value property accessors (`print_area`, `auto_filter`) across `WorksheetBuilder`, `StreamWriter`, `WorksheetProxy`, and `WorkbookBuilder` to 0-argument getters and dedicated `=` assignment setters.
57
+ - Unify boolean 0-argument getters to `?` predicate methods across builders: `TableBuilder` (`#show_row_stripes?`, `#show_column_stripes?`, `#show_first_column?`, `#show_last_column?`, `#totals_row?`, `#auto_filter?`), `DataValidationBuilder` (`#allow_blank?`, `#show_input_message?`, `#show_error_message?`), `ConditionalFormatBuilder` (`#bold?`, `#italic?`, `#stop_if_true?`, `#above_average?`, `#equal_average?`, `#percent?`, `#bottom?`), `ChartBuilder` (`#plot_visible_only?`, `#show_legend_key?`), `ChartBuilder::SeriesBuilder` (`#smooth?`), `WorksheetBuilder`/`StreamWriter`/`WorksheetProxy` (`#fit_to_page?`), and `WorkbookBuilder`/`StreamWriter` (`#show_sheet_tabs?`).
58
+ - Normalize structured metadata methods (`page_setup`, `page_margins`, `header_footer`, `sheet_protection`, `freeze_pane`, `split_pane`, `selection`, `sort_state`, `outline_properties`, `print_titles`) across `WorksheetBuilder`, `StreamWriter`, `WorksheetProxy`, and `WorkbookBuilder` to return their current immutable Value Object (or `nil`/Hash) when invoked with 0 arguments, and return `void` (`nil`) when called with configuration arguments.
59
+ - Change `TableBuilder#column` to return `void` (`nil`) instead of an internal column definition hash.
60
+ - Separate internal pipelines of `Xlsxrb.read` and `Xlsxrb.load`: `Xlsxrb.read` parses minimal streaming metadata directly yielding `StreamSheet` instances, while `Xlsxrb.load` materializes `Elements::Worksheet` directly without allocating intermediate `StreamSheet` instances or double-validating.
61
+ - Make `Elements::Cell` fully immutable by freezing instances upon instantiation in `Cell#initialize` and `Cell.fast_create`.
62
+ - Restrict `Elements::Workbook#sheets`, `#sheet`, `#[]`, `#each`, and `#active_sheet` signatures to `Elements::Worksheet` instances only.
63
+ - Rename `Elements::Styles#num_fmt` to `number_format_code`.
64
+ - Rename `Elements::Dxf` member and keyword `:num_fmt` to `:number_format`.
65
+ - Rename `Elements::SheetProperties` member and keyword `:page_setup_pr` to `:page_setup_properties`.
66
+ - Unify `StyleBuilder` single-attribute methods to dedicated 0-argument getters (`font_size`, `font_name`, `font_color`, `underline`, `vert_align`, `fill_color`, `align_horizontal`, `align_vertical`, `text_rotation`, `indent`, `number_format`) and assignment setters (`font_size=`, `font_name=`, etc.), and 0-argument boolean predicates (`bold?`, `italic?`, `strike?`, `underline?`, `wrap_text?`, `shrink_to_fit?`, `locked?`, `hidden?`, `superscript?`, `subscript?`) with assignment setters (`bold=`, `italic=`, etc.).
67
+ - Return frozen `Elements::IgnoredError` value objects from `WorksheetBuilder#ignored_errors`, `StreamWriter#ignored_errors`, and `StreamWriter::WorksheetProxy#ignored_errors`.
68
+ - Encapsulate internal methods by making `StyleBuilder#resolve_color` and `StreamSheet#auto_filter_data` private.
69
+ - Update blockless `Xlsxrb.read` to return an `Enumerator[StreamSheet, void]` with managed zip container lifecycle; use `Xlsxrb.load` for in-memory random access.
70
+ - Update `WorkbookBuilder#sheet` and `StreamWriter#sheet` parameter signatures with explicit keyword arguments `state: nil, tab_color: nil, code_name: nil`.
71
+ - Update `StyleBuilder#border` and `StyleBuilder#alignment` parameter signatures with explicit keyword arguments.
72
+ - Synchronize `RubyLsp::Xlsxrb::CompletionListener` completion items with the canonical v0.2.0 API.
73
+ - Unify `Xlsxrb.array_formula` signature to remove optional positional `ref` in favor of keyword `ref:`.
74
+ - Rename `Elements::FilterColumn` member `:col_id` to `:column_id`.
75
+ - Rename `Elements::WorkbookProperties` member `:active_tab` to `:active_sheet`, and rename `Elements::Workbook#active_tab` to `#active_sheet_index`.
76
+ - Unify `Elements::Worksheet` constructor parameter `sheet_calc_pr:` to `sheet_calc_properties:` and simplify `#with` to canonical keyword arguments.
77
+ - Change the default ZIP deflate level from zlib's default (6) to 1, exposed as `Xlsxrb::DEFAULT_COMPRESSION_LEVEL` and used when `compression_level` is omitted or `nil`. Writes are 17 to 43% faster and files 5 to 41% larger in the measurements of [ADR 0009](docs/adr/0009-default-zip-compression-level.md); pass `compression_level: 6` for the previous output.
78
+ - Raise `Xlsxrb::ParseError` when `Xlsxrb.read` or `Xlsxrb.load` opens a ZIP archive without a workbook part, such as an OpenDocument spreadsheet renamed to `.xlsx`. It was read as a workbook without sheets.
79
+ - Raise `Errno::ENOENT` (or `Errno::EISDIR`) when `Xlsxrb.read` or `Xlsxrb.load` gets a String that is neither XLSX or encrypted file content nor an existing file, instead of parsing the path itself as ZIP content and raising `ZipError: Invalid magic number`. Byte strings that are not an XLSX archive still raise `ZipError`.
80
+ - Raise `ArgumentError` for style options that `style` does not know (for example `bolt: true` or `size:` instead of `font_size:`), with a suggestion for the closest valid key, and for a nested group given together with its flat keys (`font: { size: 14 }, bold: true`). These options were silently ignored.
81
+ - Raise `ArgumentError` when a cell, row, or column refers to a style name that was never defined, with a suggestion for the closest defined name. Such cells were silently written unstyled. `:default` and `:none`, style indexes, and styles defined later in an `Xlsxrb.build` block are still accepted.
82
+ - Raise `ArgumentError` for keyword arguments that an `Elements` value object does not know, in `new` and `with`, including key names that 0.1.x accepted and ignored (for example `FreezePane.new(col: 1)`, `Font.new(sz: 11)`, or `Hyperlink.new(ref: "A1")`). Unknown keys were silently dropped, so a typo or an old name lost the value without an error. The message names the member to use for an old key name, or suggests the closest member for a typo. An old key name given together with its member (as in hashes read from files, which carry both) is dropped. `Chart`, `ConditionalFormat`, `ConditionalFormatRule`, `PivotTable`, `Shape`, `SortState`, `SparklineGroup`, and `Table` still collect other keys in their `options` member.
83
+ - Raise `ArgumentError` for border styles that are not border style names, with a suggestion for the closest one, for example `"slantedDashDot"` for `slantDashDot`. The style was written as given, which Excel does not accept.
84
+ - Lower the minimum required Ruby version from 4.0 to 3.4, and replace the Ruby 4.0-only `Array#rfind` in the drawing reader with `reverse_each.find`.
85
+
86
+ ### Removed
87
+ - Remove dead private helper `Xlsxrb.write_workbook`.
88
+ - Remove legacy `unmapped_data` fallbacks for `:style_index` in `Elements::Row#initialize`, and `:style_index`, `:style`, `:best_fit`, and `:collapsed` in `Elements::Column#initialize`.
89
+ - Hide non-`?` boolean member reader methods on all 28 `Elements::MetadataRecord` `Data.define` classes and `Elements::Formula#calculate_always`.
90
+ - Remove singular property mutators (`sheet_property`, `workbook_property`, `core_property`, `app_property`) across builders in favor of unified `sheet_properties`, `workbook_properties`, `core_properties`, and `app_properties`.
91
+ - Remove dual getter/setter `value = OMITTED` parameter branches and non-`?` boolean getter methods (`bold`, `italic`, `strike`, `wrap_text`, `shrink_to_fit`, `locked`, `hidden`, `superscript`, `subscript`) from `StyleBuilder`.
92
+ - Remove `WorkbookBuilder#hyperlink` and `WorkbookBuilder#comment` delegators (use top-level `Xlsxrb.hyperlink` and `Xlsxrb.comment`).
93
+ - Remove legacy table key fallbacks (`:total_row_formula`, `:total_formula`, `:total_row`, `:total_row_count`) in `DslHelpers` and writers in favor of `:totals_row_formula`, `:totals_row`, and `:totals_row_count`.
94
+ - Remove legacy rule `:size` fallback in `DslHelpers.extract_dxf_from_rule!` (retaining `:font_size`).
95
+ - Remove legacy duplicate keys (`from_col`/`to_col`, `col:`, `col_fields:`, `dest_ref:`, `active_tab:`, `cols:`, `col_breaks:`, `si:`) across builders and writers in favor of canonical keys (`from_column`/`to_column`, `column:`, `column_fields:`, `destination:`, `active_sheet_index:`, `columns:`, `column_breaks:`, `shared_index:`).
96
+ - Remove in-memory `#close` on `Elements::Workbook` and `Elements::Worksheet`, and remove `#load` on `Elements::Worksheet` (`StreamSheet#close` and `StreamSheet#load` remain intact).
97
+ - Remove asymmetric legacy methods on `StreamSheet`: `#sheet_views`, `#first_column_index`, `#last_column_index`, `#legacy_drawing`, and `#ext_lst` in favor of `#sheet_view` and `#column_range`.
98
+ - Remove `Xlsxrb._read_workbook` and `Elements::Workbook#_load`.
99
+ - Remove deprecated alias `DslHelpers.sheet_name` in favor of `DslHelpers.sanitize_sheet_name`.
100
+ - Remove unused private cell serialization methods `build_raw_cell`, `build_row_attrs`, and `self.build_raw_cell_from_value` in `lib/xlsxrb.rb`.
101
+ - Remove empty `Xlsxrb::Utils` module and `lib/xlsxrb/utils.rb`.
102
+ - Remove positional offset arguments and `col_delta:` keyword from `Xlsxrb.expand_formula`, unifying the signature to `def self.expand_formula(formula, from_ref: nil, to_ref: nil, row_delta: nil, column_delta: nil)`.
103
+ - Remove singular `column:` and `row:` keyword arguments from `defined_name` across `WorkbookBuilder`, `WorksheetBuilder`, `StreamWriter`, and `WorksheetProxy` (unified to `columns:` and `rows:`), and align `DslHelpers.normalize_defined_name_value`.
104
+ - Remove `show_symbols:` keyword argument from `outline_properties` across `WorksheetBuilder`, `StreamWriter`, and `WorksheetProxy` (unified to `show_outline_symbols:`).
105
+ - Remove non-predicate boolean getters across builders: `TableBuilder` (`#show_row_stripes`, `#show_column_stripes`, `#show_first_column`, `#show_last_column`, `#totals_row`, `#auto_filter`), `DataValidationBuilder` (`#allow_blank`, `#show_input_message`, `#show_error_message`), `ConditionalFormatBuilder` (`#bold`, `#italic`, `#stop_if_true`, `#above_average`, `#equal_average`, `#percent`, `#bottom`), `ChartBuilder` (`#plot_visible_only`, `#show_legend_key`), `ChartBuilder::SeriesBuilder` (`#smooth`), `WorksheetBuilder`/`StreamWriter`/`WorksheetProxy` (`#fit_to_page`), `WorkbookBuilder`/`StreamWriter` (`#show_sheet_tabs`), and non-predicate `#escape_formulas` readers on `WorkbookBuilder`, `WorksheetBuilder`, `StreamWriter`, and `WorksheetProxy` in favor of their `?` predicate equivalents.
106
+ - Remove workbook-level delegation methods and stream-lifecycle helpers (`active_sheet`, `active_sheet=`, `first_sheet`, `first_sheet=`, `show_sheet_tabs`, `show_sheet_tabs=`, `tab_ratio`, `tab_ratio=`, `workbook_property`, `workbook_protection`, `core_property`, `app_property`, `custom_property`, `properties`, `default_font`, `sheet_names`, `cleanup!`, `internal_sheet_setup`) from `StreamWriter::WorksheetProxy` to establish full method symmetry with `WorksheetBuilder`.
107
+ - Remove positional argument setters from `ChartBuilder` and `SeriesBuilder` in favor of pure 0-argument getters, dedicated `=` assignment setters, `title(**kwargs)`, keyword dictionary methods (`legend(**kwargs)`, `plot_area(**kwargs)`, etc.), and `series(**kwargs, &block)`.
108
+ - Remove `#[]`, `#[]=`, and `:in` fallback from `DataValidationBuilder` and `DslHelpers.normalize_data_validation`.
109
+ - Remove `#[]`, `#[]=`, `formulas`, `formulas=`, and fallbacks for `:size` and `:format_id` from `ConditionalFormatBuilder`.
110
+ - Remove `number_format_id` and `number_format_id=` from `StyleBuilder` in favor of `number_format` and `number_format=`.
111
+ - Remove duplicate and ambiguous keys in `StyleBuilder#font` (retaining `:name`, `:size`, `:color`, `:vert_align`) and top-level `StyleBuilder#apply_options!` (retaining `:font_name`, `:font_size`, `:font_color`, `:vert_align`, `:number_format`).
112
+ - Remove all remaining deprecated builder methods and aliases across `WorkbookBuilder`, `WorksheetBuilder`, `StreamWriter`, and `StreamWriter::WorksheetProxy`:
113
+ - Removed `set_default_font`, `active_tab`, `active_tab=`, `protect_workbook`, `protect_sheet`, `validate_data`, `select_cell`, `page_break_row`, `page_break_col`, `add_row`, `skip_row`, `group_column`, `group_cols`, `group_col`, `group_row`, `outline_pr`, `add_sparkline`, `add_comment`, `add_threaded_comment`, `background_picture`, `background_picture=`, `picture`, `picture=`, `add_protected_range`, `add_cell_watch`, `ignore_error`, `add_ignored_error`, `sheet_calc_pr`, `sheet_calc_pr=`, `calc_pr`, `calc_pr=`, `phonetic_pr`, `phonetic_pr=`.
114
+ - Removed `ChartBuilder#secondary_axis`, `ChartBuilder#secondary_axis=`, and `SeriesBuilder#secondary_axis`.
115
+ - Removed deprecated methods on `StyleBuilder`: `size`, `size=`, `sz`, `sz=`, `num_fmt`, `num_fmt=`, `num_fmt_id`, `num_fmt_id=`.
116
+ - Removed deprecated methods on `TableBuilder`: `add_column`, `total_row`, `total_row=`, `total_row_count`, `total_row_count=`.
117
+ - Removed deprecated methods on `DataValidationBuilder`: `range`, `range=`, `col`, `col=`, `row`, `row=`, `in`, `in=`, `error`, `error=`, `prompt`, `prompt=`.
118
+ - Removed deprecated methods on `ConditionalFormatBuilder`: `range`, `range=`, `col`, `col=`, `row`, `row=`, `format_id`, `format_id=`, `size`, `size=`, `sz`, `sz=`.
119
+ - Removed dual getter/setter argument branches across builders (`active_sheet`, `first_sheet`, `show_sheet_tabs`, `tab_ratio`, `code_name`, `fit_to_page`, `tab_color`, `sheet_calc_properties`, `phonetic_properties`, `background_image`, `state`, `auto_filter`, `print_area`), strictly enforcing zero-argument getters and dedicated arity-1 assignment setters (`xxx=`).
120
+ - Removed deprecated keyword arguments: `styles:` and `style:` on `row` (use `cell_styles:` and `row_style:`); coordinate kwargs `row:`, `col_start:`, `col_end:`, `row_start:`, `row_end:` on `merge` (use `merge(range)`); `from_col:` and `to_col:` on `image` and `shape` (use `from_column:` and `to_column:`); `default_col_width:`, `base_col_width:`, and `outline_level_col:` on `sheet_format` (use `default_column_width:`, `base_column_width:`, `outline_level_column:`); `cols:` on `print_titles` (use `columns:`); `col:`, `ref_sheet:`, and `local:` on `defined_name` (use `column:` and `scope:`); `col:` and `except_col:` on `data_validation`, `conditional_format`, and `ignored_error` (use `columns:` and `except_columns:`); `si:` on `Formula` (use `shared_index:`).
121
+ - Remove `StreamWriter#shared_strings` reader method in favor of `shared_strings?`.
122
+ - Remove constant `Xlsxrb::MAX_COL` in favor of `Xlsxrb::MAX_COLUMN`.
123
+ - Remove `Xlsxrb::Error::DIV0`..`VALUE` cell error constants on the exception class in favor of `Elements::CellError::*`.
124
+ - Remove `Elements::RichTextRun#sz` in favor of `font_size`.
125
+ - Replace the `top_row` and `left_column` members of `Elements::FreezePane` and `Elements::SplitPane` with `top_left_cell`. Neither member was read or written.
126
+ - Remove the `escape_formulas:` option of `Xlsxrb.write`, `Xlsxrb.build`, `StreamWriter`, `WorkbookBuilder`, and `WorksheetBuilder`, with its `escape_formulas?` and `escape_formulas=` accessors. It was passed down to the worksheet writer but never used: output was identical with and without it. Strings are always written as text cells, which Excel does not evaluate as formulas, with or without the option.
127
+ - Remove deprecated `Xlsxrb.modify`, `Elements::Workbook#update_sheet`, and `Elements::Worksheet#update_cell` in favor of streaming transformations (`Xlsxrb.read` + `Xlsxrb.write`) or template generation via `Xlsxrb.write`.
128
+ - Remove Hash-like access (`#[]`, `#key?`, `#dig`, `#fetch`, `#merge`, and `== Hash`) on `Elements::MetadataRecord` value objects and `Elements::Hyperlink#[]` in favor of direct reader method calls and `#to_h`.
129
+ - Remove deprecated methods on `Elements::Row`: `pad_empty_cells` (use `padded`), `cells_hash` (use `cells`), `formulas` (use `formula_expressions`), and bare boolean queries (`hidden`, `custom_height`, `collapsed` in favor of `?`-suffixed predicates).
130
+ - Remove deprecated methods on `StreamRow`: `to_h` (use `values` or `cells`), `formulas` (use `formula_expressions`), and bare boolean queries (`hidden`, `custom_height`, `collapsed` in favor of `?`-suffixed predicates).
131
+ - Remove deprecated methods on `Elements::Cell`: `content` (use `value`), `column_index`, `column_letter`, `parse_ref`, `date1904` (use `date1904?`), `link?` (use `hyperlink?`), and `threaded_comments?` (use `threaded_comment?`).
132
+ - Remove keyword argument `date1904:` on `Cell#to_date` and `Cell#to_time`.
133
+ - Remove deprecated `StreamSheet#cell` and `Elements::Worksheet#cell` in favor of coordinate bracket access (`sheet[...]`).
134
+ - Remove deprecated `StreamSheet#first_row` and `StreamSheet#last_row` in favor of `row_range` or `dimension_bounds`.
135
+ - Remove deprecated `CoordinateAccess#cells_hash`, `first_column`, `first_col`, `last_column`, `last_col`, and `cell_value`.
136
+ - Remove deprecated `Elements::Image#cell` and `cell_ref` (use `ref`), `from_col` (use `from_column`), and `to_col` (use `to_column`).
137
+ - Remove remaining deprecated aliases, duplicate Data members, and initialization fallbacks across `Elements::*` Value Objects:
138
+ - Remove duplicate `Data.define` members: `:cols` from `Elements::PrintTitles` (use `:columns`), `:col` from `Elements::FreezePane` (use `:column`), `:first_tab` from `Elements::WorkbookProperties` (use `:first_sheet`), `:outline_pr` from `Elements::SheetProperties` (use `:outline_properties`), `:rel_id`, `:ext`, and `:filename` from `Elements::BackgroundImage` (use `:r_id`, `:extension`, `:path`), and `:location` from `Elements::PivotTable` (use `:ref`).
139
+ - Remove `Elements::RichTextRun#[]` and `other.is_a?(Hash)` branches from `Elements::Hyperlink#==`, `Elements::CustomProperty#==`, and `Elements::Styles#==`.
140
+ - Remove non-predicate formula aliases on `Elements::Formula`: `always_calculate_array`, `assign_to_name`, `data_table_2d`, and `data_table_row` in favor of predicate methods (`?`).
141
+ - Remove `Elements::Column#letter` in favor of canonical `column_letter`.
142
+ - Remove `Elements::Styles#format_code` in favor of `number_format`.
143
+ - Remove `StreamSheet#_load` in favor of `StreamSheet#load`.
144
+ - Remove deprecated `conditional_formatting:` and `col_breaks:` keyword arguments in `Elements::Worksheet#initialize` in favor of `conditional_formats:` and `column_breaks:`.
145
+ - Remove legacy keyword arguments and aliases on element Value Objects: `SheetFormat` (`default_col_width`, `outline_level_col`, `base_col_width`), `FilterColumn` (`hidden_button:`), `PageBreak` (`manual:`), `Comment` (`cell:` and `alias cell ref`), `ThreadedComment` (`cell:`, `person_id:`, `dt:`, `timestamp:`, `done:`, and `alias done resolved`), `DataValidation` (`show_dropdown` and `show_dropdown?`), `ConditionalFormatRule` (`format_id` and `alias formulas formula`), `TableColumn` (`data_formula:` and `alias data_formula calculated_column_formula`), `Sparkline` (`location_ref`, `location`, `data_ref`, `f`, `data`), `SparklineGroup` (`display_empty`, `max`, `min`), `Chart` (`rid`, `chart_type`, `from_col`, `to_col`), `HeaderFooterImage` (`rid`, `ext`, `filename`), `Font` (`sz`), `Fill` (`pattern`), and `CellXf` (`number_format_id`).
146
+ - Remove deprecated `Elements::Worksheet#dimension=` (use `with(dimension: ...)`), `Elements::Worksheet#with_images`, and `StreamSheet#with_images`.
147
+ - Remove deprecated `Elements::Worksheet#conditional_formatting` and `StreamSheet#conditional_formatting` in favor of `conditional_formats`.
148
+ - Remove deprecated `Elements::Styles#add_xf`, `add_num_fmt`, and `num_fmts` in favor of `add_cell_xf`, `add_number_format`, and `number_formats`.
149
+ - Remove deprecated `Elements::Styles#xf`, `num_fmt`, `format_code_for`, `classification_for`, and `sz`.
150
+ - Remove deprecated `Xlsxrb::Utils` coordinate and date conversion methods (`col_name_to_index`, `col_index_to_name`, `ref_to_row_col`, `row_col_to_ref`, `parse_range`, `range_to_ref`, `date_to_serial`, `serial_to_date`, `serial_to_time`, `time_to_serial`, `split_coordinate`, `valid_excel_date?`, `expand_formula`, `datetime_to_serial`) in favor of canonical `Xlsxrb.*` entry points.
151
+ - Remove deprecated transitional top-level aliases on `Xlsxrb`: `datetime_to_serial`, `serial_to_datetime`, `color_to_hex`, `sheet_name`, `stream`, and `format` (use `Xlsxrb.format_value`).
152
+ - Remove deprecated transitional aliases `to_workbook` on `Workbook`, `to_worksheet` on `Worksheet` and `StreamSheet`, `each_sheet` on `Workbook`, and `col_breaks` on `Worksheet` and `StreamSheet`.
153
+ - Remove non-predicate boolean queries on element readers (`trim_empty_rows`, `pad_empty_rows`, `pad_empty_cells`, `fit_to_page`, `show_sheet_tabs`, `full_calc_on_load`) in favor of `?`-suffixed methods (`trim_empty_rows?`, `pad_empty_rows?`, `pad_empty_cells?`, `fit_to_page?`, `show_sheet_tabs?`, `full_calc_on_load?`).
154
+
155
+ ### Fixed
156
+ - Write the pattern type of cell fills in `Xlsxrb.build` and in `Xlsxrb.write` of loaded workbooks. The styles writer read `:pattern` while `Elements::Fill` names it `:pattern_type`, so every fill was written with `patternType="none"` and cell fill colors did not show.
157
+ - Protect the workbook with `workbook_protection(password:)`. `Elements::WorkbookProtection` had no `password` member, so the password was dropped and the workbook was written without one. A plain-text password is now hashed with SHA-512, as for `sheet_protection`, and a 4-digit hexadecimal value is written as the legacy `workbookPassword`. `Xlsxrb.load` also keeps the hash, revision lock, and revisions password attributes of `<workbookProtection>`, which it dropped, so that `Xlsxrb.write` writes them back.
158
+ - Keep filter column conditions in `Elements::Worksheet#filter_columns` and `StreamSheet#filter_columns`. Hashes in the `filter_column` format (`type:`, `values:`, `operator:`, ...) were passed to `Elements::FilterColumn.new`, which dropped those keys, so the readers returned empty filter columns and `Xlsxrb.write` of value objects wrote an `<autoFilter>` without its conditions.
159
+ - Write threaded comments built from `Elements::ThreadedComment` with their `created_at` time and `resolved` state; the writer only looked at the `dt`/`timestamp` and `done` keys.
160
+ - Write the `horizontalDpi` and `verticalDpi` attributes of page setup when they are positive; the schema requires at least 1.
161
+ - Keep the pattern type of differential format fills loaded from `styles.xml` (`Elements::Dxf#fill`). The styles reader names it `pattern:`, which `Elements::Fill` dropped.
162
+ - Wrap keyword arguments with double splat in Data.define constructors across Elements to prevent heap corruption and segfaults in CRuby 4.0 Ractors.
163
+ - Keep the top-left cell of freeze and split panes. `freeze_pane(top_left_cell:)` and the reader both used a `top_left_cell` that `Elements::FreezePane` and `Elements::SplitPane` did not have, so the value objects dropped it and the writer always wrote the cell just past the frozen rows and columns; the reader also did not read `topLeftCell` for frozen panes.
164
+ - Keep the time of day of `DateTime` values. `Xlsxrb.date_to_serial`, `Xlsxrb.time_to_serial`, and cell values written by `Xlsxrb.write` and `Xlsxrb.build` treated `DateTime` (a subclass of `Date`) as a date, dropping the time and applying the date-only format. They now handle it like `Time`.
165
+ - Write worksheets whose `selection` is an Array, one selection per pane, as `Elements::Worksheet` accepts. `Xlsxrb.write` called `to_h` on the Array and raised `TypeError`.
166
+ - Link each sheet that `Xlsxrb.write` streams from a block to its own drawing, comments, threaded comments, tables, and pivot tables. Part numbers restarted at 1 for every sheet, so the relationships of later sheets pointed to the parts of the first sheet that had them, and the second sheet showed the first sheet's images, comments, and tables.
167
+ - Write each image of a sheet to its own media file. Every image in a drawing was written as `xl/media/imageN.png` with the drawing's number, so a sheet with two or more images produced duplicate ZIP entries and one picture for all of them.
168
+ - Read the name, location, and cache ID of pivot tables saved by Excel 2010 and later. The `x14:pivotTableDefinition` that such files keep in `extLst` replaced the pivot table the reader had collected.
169
+ - Resolve pivot table fields given by name, such as `row_fields: ["Region"]`, through `field_names:`, and accept `field:` (a name or an index) in data fields. Names were written as is, as in `<field x="Region"/>` and `fld=""`, which is invalid. A name without `field_names:`, or one missing from it, raises `ArgumentError`.
170
+ - Write workbooks loaded with pivot tables. Loaded pivot tables carry their source, field names, and shared items in `cache`, but the writer looked for the builder's `source_ref` and `field_names`, so `Xlsxrb.write` raised `NoMethodError`; a pivot table on a sheet named `Sheet1` also raised `ArgumentError: sheet already exists`. Loaded pivot tables are now written from their cache definition, including sources that name a table, with typed shared items (`<n>`, `<b>`, `<m>`). As for pivot tables built with `pivot_table`, the cache is written with `refreshOnLoad`, so Excel rebuilds it from the source data; the item order and other layout details of the original pivot table are not kept.
171
+ - Write the `sz` element of differential format fonts before `color` and `name`, in the order of `CT_Font`.
172
+ - Keep the cell style formats (`cellStyleXfs`) and named cell styles (`cellStyles`, such as Normal and Heading 1) of loaded workbooks. The writer always wrote one default style format and no named styles, so cell formats that referred to other style formats pointed to missing entries.
173
+ - Keep the chart type of loaded charts. The reader returns the chart element name (`"lineChart"`), which the writer did not recognize, so every loaded chart was written as a bar chart.
174
+ - Raise `ArgumentError` when `Xlsxrb.write` gets an `Elements::Workbook` without sheets, as `Xlsxrb.build` and `StreamWriter` do, instead of writing a workbook with an empty `<sheets>` element, which is invalid.
175
+ - Keep the built-in unit of chart display units (`val_axis_disp_units`) whose label has a fill, line, or number format. Reading the label replaced the unit with a hash that had only the label.
176
+ - Write the children of chart series in schema order: `spPr` first, then `invertIfNegative`, `marker`, or `explosion`, then `dPt`. Series with a fill or line together with one of the others, or with data points, were invalid.
177
+ - Give pivot table row and column fields without `items:` an `<items>` list with the default subtotal item. Excel for Mac crashed when it opened a pivot table whose axis fields had no items.
178
+ - Keep the table style of loaded tables. The reader returns the style as a hash, which `Elements::Worksheet` wrapped as the style name, so `Xlsxrb.write` wrote `<tableStyleInfo name="{name: ...}">` and Excel repaired the table; `StreamSheet#tables` dropped the style.
179
+ - Write pivot fields with `defaultSubtotal="0"` without the default subtotal item, and keep the `firstHeaderRow`, `firstDataRow`, and `firstDataCol` of a loaded pivot table's location instead of writing 1 for each. Excel repaired loaded pivot tables whose fields turned off the default subtotal. Loaded pivot tables are written without page field counts, since their page fields are not written.
180
+ - Leave sheets unprotected when their `<sheetProtection>` element has no `sheet` attribute, which defaults to false. The reader left `sheet` unset and the writer treated that as protected, so `Xlsxrb.write` of a loaded workbook protected such sheets.
181
+ - Keep the `family` and `scheme` of fonts loaded from `styles.xml`.
182
+ - Keep comments that are shown permanently instead of on hover. The VML drawing always hid them and the reader did not read `<x:Visible/>`; `comment` on `WorksheetBuilder` and `StreamWriter` now take `visible:`, and `Elements::Comment#visible?` is read from and written to the VML drawing.
183
+ - Keep the position and size of comment boxes. The VML writer placed every box next to its cell and the reader did not read `<x:Anchor>`, so loaded comments that were shown permanently moved and could overlap. `Elements::Comment#anchor` holds the eight `<x:Anchor>` integers; `nil` keeps the default box next to the cell.
184
+ - Decode entity references such as `&amp;` and `&quot;` in attribute values read from files, including number format codes, hyperlink display texts, tooltips, and locations, and table column names. REXML's SAX2 parser passes attribute values as written, so a loaded format such as `"$"#,##0` read back as `&quot;$&quot;#,##0` and `Xlsxrb.write` wrote it as `&amp;quot;$&amp;quot;#,##0`, changing the format.
185
+ - Keep gradient fills. `Elements::Fill` had no member for a `<gradientFill>`, so `Xlsxrb.load` dropped the gradients of a workbook and wrote such fills as empty pattern fills, and `Xlsxrb.build` with `fill_gradient` raised `ArgumentError`. `Elements::Fill#gradient` holds the gradient type, degree, sides, and stops.
186
+ - Write `firstSliceAng` and `holeSize` in doughnut charts, 0 and 50 unless given; doughnut charts without them did not validate.
187
+ - Write sheet tab colors given by name, such as `tab_color: :red`, as aRGB hex. The name was written as `rgb="red"`, which is not a valid color. An unknown name raises `ArgumentError`.
188
+ - Write workbooks loaded from files with rich-text comments, such as comments that Excel starts with the author's name in bold. `MetadataRecord#to_h` called `Enumerable#to_h` on the `Elements::RichText` text of `Elements::Comment`, so `Xlsxrb.write` raised `TypeError`. `to_h` now keeps `RichText` values as they are.
189
+ - Write workbooks loaded from files whose `docProps/app.xml` lists `HeadingPairs`, as files saved by Excel do. `MetadataRecord#to_h` called `to_h` on the `[name, count]` pairs of `AppProperties#heading_pairs`, so `Xlsxrb.write` raised `TypeError`.
190
+ - Keep the date or time number format on `Date` and `Time` cell values that are given a cell style without a `number_format` (for example `cell_styles: [:bold]`). The style replaced the automatic `yyyy-mm-dd` format, so Excel showed the serial number. Such cells now get a variant of their style that adds the default format, in both `Xlsxrb.write` blocks and `Xlsxrb.build`.
191
+ - Inherit `sheet_format` `default_column_width` as the width of columns that define `style:` without `width:`. The column writer still looked up the removed `default_col_width` key and dropped the width.
192
+ - Raise `ArgumentError` when `rows:` or `columns:` on `data_validation` and `conditional_format` reach outside the Excel grid (for example `rows: 1..Xlsxrb::MAX_ROW`, which is one past the last 0-based row) instead of writing an invalid reference such as `A2:A1048577`.
193
+ - Keep the REXML entity expansion limits that the application set before `require "xlsxrb"`. Loading xlsxrb reset `REXML::Security.entity_expansion_limit` and `entity_expansion_text_limit` to the REXML defaults, which undid hardening such as an application setting the limit to 0 to disable entity expansion.
194
+ - Keep reading entries after one that ends with a data descriptor when `ZipReader` falls back to walking local headers (an archive without a readable central directory). Ruby's `Zlib::Inflate` drops input past the end of the deflate stream, so the reader skipped over the following entries; it now rewinds by the compressed length, and reads 8-byte sizes from the data descriptor of ZIP64 entries.
195
+ - Build cells in streaming and in-memory reads with one direct initializer instead of an `instance_variable_set` call per attribute, which had grown from 7 to 14 calls per cell since 0.1.10. A 1,000,000-cell streaming read is about 12% faster.
196
+ - Take the `r`, `s`, and `t` cell attributes from the cell scanning regex when they appear in that order, as Excel and xlsxrb write them, instead of three more regex lookups per cell (other orders still fall back to those lookups), and stop copying cell values that need no whitespace stripping or re-encoding. A 1,000,000-cell streaming read is about 16% faster and allocates 43% fewer objects.
197
+ - Check cell reference digits with plain byte comparisons instead of `Comparable#between?`, and yield cells instead of calling a block Proc, in the cell scanning loops (about 3% faster streaming reads).
198
+ - Consume inflated ZIP entry data by offset instead of `slice!`, which moved the rest of each inflated chunk on every read, and stop re-encoding chunks that are already binary. Streaming reads run half as many garbage collections.
199
+ - Write ZIP64 records when an entry size, a file offset, or the entry count exceeds the 32-bit (16-bit for counts) ZIP fields. Sizes were truncated to 32 bits, so a worksheet whose XML exceeded 4 GiB uncompressed produced a corrupt XLSX without an error. Archives below these limits are written unchanged, except that entries streamed to unseekable output are declared ZIP64 up front, because their size is unknown when the local header is written. `ZipReader` also reads the ZIP64 end of central directory record. See [ADR 0008](docs/adr/0008-zip64-only-when-a-limit-is-exceeded.md).
200
+
1
201
  ## [0.1.18] - 2026-11-07
2
202
 
3
203
  ### Added
data/README.md CHANGED
@@ -36,7 +36,7 @@ Maintaining a gem that supports both reading and writing across streaming and in
36
36
  - Streaming Support: Low-memory row streaming for reading and writing spreadsheets ($O(1)$ memory on reads; writes buffer unique shared strings).
37
37
  - OpenXML Interoperability: Compliant with ISO/IEC 29500 (ECMA-376) and validated against the Microsoft [Open XML SDK](https://github.com/dotnet/Open-XML-SDK).
38
38
  - AI-Assisted Maintenance: Uses AI coding agents for automated quality assurance and verification workflows. Operational guidelines are defined in [AGENTS.md](AGENTS.md).
39
- - Ruby 4.0+: Requires Ruby 4.0 or higher.
39
+ - Ruby 3.4+: Requires Ruby 3.4 or higher.
40
40
 
41
41
  ### Autonomous Quality Assurance
42
42
 
@@ -49,6 +49,8 @@ bundle add xlsxrb
49
49
  # Or without Bundler: gem install xlsxrb
50
50
  ```
51
51
 
52
+ Upgrading from 0.1.x: see [docs/UPGRADING-0.2.md](docs/UPGRADING-0.2.md) for removed APIs, their replacements, and changed defaults.
53
+
52
54
  ## Interactive Playground (WebAssembly)
53
55
 
54
56
  Try `xlsxrb` directly in your browser without installing anything!
@@ -99,9 +101,9 @@ require "xlsxrb"
99
101
 
100
102
  Xlsxrb.write("large_output.xlsx") do |writer|
101
103
  writer.sheet("Sales Data") do |sheet|
104
+ sheet.column(0, width: 15.5)
102
105
  sheet.row(["Date", "Amount", "Status"])
103
106
  sheet.row([Date.today, 100, true])
104
- sheet.column(0, width: 15.5)
105
107
  end
106
108
  end
107
109
  ```
@@ -153,19 +155,23 @@ Xlsxrb.write("output.xlsx") do |out_wb|
153
155
  out_wb.sheet("Processed") do |out_sheet|
154
156
  Xlsxrb.read("input.xlsx") do |in_sheet|
155
157
  in_sheet.each_row do |row|
156
- out_sheet.row(row.cells.map { |c| c.value.is_a?(Numeric) ? c.value * 1.1 : c.value })
158
+ # type_cast: true turns date-formatted cells into Date/Time (so they are not
159
+ # scaled as numbers) and keeps empty cells as nil in their column.
160
+ out_sheet.row(row.values(type_cast: true).map { |v| v.is_a?(Numeric) ? v * 1.1 : v })
157
161
  end
158
162
  end
159
163
  end
160
164
  end
161
165
  ```
162
166
 
167
+ This copies cell values only. Styles, number formats other than dates, formulas, merged cells, and column widths are not carried over; set them on the writer if the output needs them.
168
+
163
169
  ---
164
170
 
165
171
  ### Template Migration & AI Code Generation
166
172
 
167
173
  > [!NOTE]
168
- > `Xlsxrb.modify` is deprecated. Runtime data transformations are handled with streaming pipelines (`Xlsxrb.read` -> `Xlsxrb.write`), while template-based report generation is performed by converting templates into declarative `Xlsxrb.write` DSL code.
174
+ > `Xlsxrb.modify` was removed in 0.2.0 in favor of `Xlsxrb.read` -> `Xlsxrb.write` and `Xlsxrb.load`. Runtime data transformations are handled with streaming pipelines (`Xlsxrb.read` -> `Xlsxrb.write`), while template-based report generation is performed by converting templates into declarative `Xlsxrb.write` DSL scripts.
169
175
 
170
176
  To migrate an existing Excel template (`template.xlsx`) into reproducible Ruby code, inspect the template structure with `Xlsxrb.load` and provide it to an AI coding assistant:
171
177
 
@@ -204,18 +210,35 @@ end
204
210
 
205
211
  ### Date and Time Handling
206
212
 
207
- Excel stores dates and times as floating-point serial numbers without timezone information. When reading spreadsheet files, `xlsxrb` returns date-formatted cells as UTC `Time` objects (`Time.utc`).
213
+ Excel stores dates and times as serial numbers (days since 1900, with the time of day as the fraction) and marks them as dates only through the cell's number format. `cell.value` returns that serial number as an Integer or Float. To get dates back:
208
214
 
209
- To interpret an Excel timestamp in a specific application timezone (such as JST or America/New_York), construct a local time using the year, month, day, hour, min, and sec components:
215
+ ```ruby
216
+ Xlsxrb.read("input.xlsx") do |sheet|
217
+ sheet.each_row do |row|
218
+ row.values(type_cast: true) # => ["Due", #<Date: 2026-01-02>, 2026-01-02 03:04:05 UTC]
219
+
220
+ row.cells.each do |cell|
221
+ next unless cell.date_format?
222
+
223
+ cell.to_date # => Date
224
+ cell.to_time # => Time in UTC
225
+ end
226
+ end
227
+ end
228
+ ```
229
+
230
+ When writing, `Date`, `Time`, and `DateTime` values get a date or date-time number format automatically, also when the cell has a style without its own `number_format`.
231
+
232
+ Serial numbers carry no timezone, so `to_time` returns the wall-clock time as UTC. To interpret it in an application timezone (such as JST or America/New_York), build a local time from its components:
210
233
 
211
234
  ```ruby
235
+ t = cell.to_time
236
+
212
237
  # With ActiveSupport / Rails:
213
- local_time = Time.zone.local(cell.value.year, cell.value.month, cell.value.day,
214
- cell.value.hour, cell.value.min, cell.value.sec)
238
+ local_time = Time.zone.local(t.year, t.month, t.day, t.hour, t.min, t.sec)
215
239
 
216
240
  # With Ruby standard library:
217
- local_time = Time.local(cell.value.year, cell.value.month, cell.value.day,
218
- cell.value.hour, cell.value.min, cell.value.sec)
241
+ local_time = Time.local(t.year, t.month, t.day, t.hour, t.min, t.sec)
219
242
  ```
220
243
 
221
244
  ### IDE Autocompletion & Ruby LSP Support
@@ -236,7 +259,7 @@ For full details, see [docs/SPEC_SOURCES.md](docs/SPEC_SOURCES.md).
236
259
 
237
260
  ## Benchmarks
238
261
 
239
- Benchmark processing 1,000,000 cells (100,000 rows × 10 cols) across popular Ruby gems:
262
+ Benchmark processing 1,000,000 cells (100,000 rows × 10 cols) across popular Ruby gems, with YJIT enabled for every library (Rails 7.2 and later enable YJIT by default):
240
263
 
241
264
  <p align="center">
242
265
  <img src="docs/assets/benchmark_results.svg" width="100%" alt="Ruby XLSX Performance Benchmarks"/>
@@ -244,7 +267,7 @@ Benchmark processing 1,000,000 cells (100,000 rows × 10 cols) across popular Ru
244
267
 
245
268
  For detailed metrics (peak memory, GC count, mean/median times) and architectural tradeoffs (SST vs. Inline Strings), see [docs/PEER_LIBRARIES.md](docs/PEER_LIBRARIES.md).
246
269
 
247
- To reproduce locally: `ruby benchmark.rb 100000 10`
270
+ To reproduce locally: `RUBY_YJIT_ENABLE=1 ruby benchmark.rb 100000 10`
248
271
 
249
272
  ## Quality Assurance & Testing
250
273