xlsxrb 0.1.18 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +163 -0
  3. data/README.md +34 -11
  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 +120 -67
  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 +43 -314
  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 +2 -2
  23. data/lib/xlsxrb/ooxml/workbook_parser.rb +0 -1
  24. data/lib/xlsxrb/ooxml/workbook_writer.rb +172 -93
  25. data/lib/xlsxrb/ooxml/worksheet_parser.rb +61 -29
  26. data/lib/xlsxrb/ooxml/worksheet_writer.rb +65 -47
  27. data/lib/xlsxrb/ooxml/writer/drawing_xml.rb +28 -11
  28. data/lib/xlsxrb/ooxml/writer/features_xml.rb +53 -14
  29. data/lib/xlsxrb/ooxml/writer/styles_xml.rb +1 -1
  30. data/lib/xlsxrb/ooxml/writer.rb +105 -41
  31. data/lib/xlsxrb/ooxml/xml_parser.rb +78 -5
  32. data/lib/xlsxrb/ooxml/zip_reader.rb +65 -15
  33. data/lib/xlsxrb/ooxml/zip_writer.rb +119 -30
  34. data/lib/xlsxrb/stream_row.rb +12 -116
  35. data/lib/xlsxrb/stream_sheet.rb +14 -261
  36. data/lib/xlsxrb/stream_writer.rb +623 -1476
  37. data/lib/xlsxrb/style_builder.rb +376 -593
  38. data/lib/xlsxrb/version.rb +1 -1
  39. data/lib/xlsxrb/workbook_builder.rb +192 -226
  40. data/lib/xlsxrb/worksheet_builder.rb +456 -1324
  41. data/lib/xlsxrb.rb +266 -1083
  42. data/sig/generated/xlsxrb/chart_builder.rbs +202 -205
  43. data/sig/generated/xlsxrb/dsl_helpers.rbs +64 -16
  44. data/sig/generated/xlsxrb/elements/cell.rbs +12 -76
  45. data/sig/generated/xlsxrb/elements/column.rbs +0 -7
  46. data/sig/generated/xlsxrb/elements/coordinate_access.rbs +5 -41
  47. data/sig/generated/xlsxrb/elements/image.rbs +3 -29
  48. data/sig/generated/xlsxrb/elements/metadata.rbs +138 -151
  49. data/sig/generated/xlsxrb/elements/row.rbs +10 -53
  50. data/sig/generated/xlsxrb/elements/styles.rbs +1 -39
  51. data/sig/generated/xlsxrb/elements/workbook.rbs +14 -78
  52. data/sig/generated/xlsxrb/elements/worksheet.rbs +5 -121
  53. data/sig/generated/xlsxrb/ooxml/reader/listeners/feature_listeners.rbs +0 -4
  54. data/sig/generated/xlsxrb/ooxml/reader.rbs +0 -3
  55. data/sig/generated/xlsxrb/ooxml/styles_parser.rbs +1 -1
  56. data/sig/generated/xlsxrb/ooxml/utils.rbs +3 -3
  57. data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +12 -0
  58. data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +16 -0
  59. data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +5 -3
  60. data/sig/generated/xlsxrb/ooxml/writer/features_xml.rbs +7 -0
  61. data/sig/generated/xlsxrb/ooxml/writer.rbs +20 -14
  62. data/sig/generated/xlsxrb/ooxml/xml_parser.rbs +70 -0
  63. data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +22 -7
  64. data/sig/generated/xlsxrb/ooxml/zip_writer.rbs +26 -1
  65. data/sig/generated/xlsxrb/stream_row.rbs +7 -42
  66. data/sig/generated/xlsxrb/stream_sheet.rbs +1 -158
  67. data/sig/generated/xlsxrb/stream_writer.rbs +457 -976
  68. data/sig/generated/xlsxrb/style_builder.rbs +206 -242
  69. data/sig/generated/xlsxrb/workbook_builder.rbs +84 -132
  70. data/sig/generated/xlsxrb/worksheet_builder.rbs +309 -685
  71. data/sig/generated/xlsxrb.rbs +43 -190
  72. data/sig/rexml.rbs +8 -0
  73. metadata +3 -5
  74. data/lib/xlsxrb/utils.rb +0 -251
  75. 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: 4e4682f8228d5ffbe3681efdc627a082ac3b7c5b037d619b921c541e0c14b0fe
4
+ data.tar.gz: c8950a741c0ddfc4a0e7db66d514a9fb4a343ea5c9054b579891d2429289d6ff
5
5
  SHA512:
6
- metadata.gz: a7980f5301fe23f6bc7577447d8d924ab6c17f2ad5f5849e9023b95cb74ac86a15d9c61d9113bbb7b4c517a8961a14e3f7c4b96e533f4e8fb6010897f21b5bed
7
- data.tar.gz: cbf3e1bdee2d617da99c32c7a5ad8e4acb4d6cd81d6cc662b6d4d46783dd0592185c142d7a4d26ca0300b66478d93780e2fde45f6ad5e29deaec80910338e245
6
+ metadata.gz: '0964cde67e062b9704140855bf2bd5bf06a2ae8484c2dab7d9158afb2e6a8ab86afb6de9654aa7c75bb659478ecee492a340ec3a1ae0da7c5798de055091d695'
7
+ data.tar.gz: 77a3927cd829adf6a7481bb25965a95e3282f59a91bf688f6e10fb19cdaa0076586bb3a2e641b975f1b9a707e6dde39d510bd408fe2991175e4f2d26d0c05dc5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,166 @@
1
+ ## [0.2.0] - 2026-11-10
2
+
3
+ Upgrading from 0.1.x: see [docs/UPGRADING-0.2.md](docs/UPGRADING-0.2.md).
4
+
5
+ ### Added
6
+ - Add `show_sheet_tabs?`, `full_calc_on_load?`, and `refresh_all?` boolean predicates on `Elements::WorkbookProperties`.
7
+ - Add `core_properties=` and `app_properties=` assignment setters on `WorkbookBuilder`, `StreamWriter`, and `StreamWriter::WorksheetProxy`.
8
+ - Add `name` reader on `StreamWriter::WorksheetProxy` to mirror `WorksheetBuilder#name`.
9
+ - 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`.
10
+ - Expose `:style_index` as a canonical `Data.define` member on `Elements::Row`.
11
+ - 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`.
12
+ - Add `sheet_protection=` assignment setter on `WorksheetBuilder`, `StreamWriter`, and `WorksheetProxy` accepting `Elements::SheetProtection`, `Hash`, `Boolean`, or `nil`.
13
+ - Add `print_titles=` assignment setter on `WorksheetBuilder`, `WorkbookBuilder`, `StreamWriter`, and `WorksheetProxy` accepting `Elements::PrintTitles`, `Hash`, or `nil`.
14
+ - 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`.
15
+ - 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`).
16
+
17
+ ### Changed
18
+ - 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`).
19
+ - Unify single-value property accessors (`print_area`, `auto_filter`) across `WorksheetBuilder`, `StreamWriter`, `WorksheetProxy`, and `WorkbookBuilder` to 0-argument getters and dedicated `=` assignment setters.
20
+ - 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?`).
21
+ - 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.
22
+ - Change `TableBuilder#column` to return `void` (`nil`) instead of an internal column definition hash.
23
+ - 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.
24
+ - Make `Elements::Cell` fully immutable by freezing instances upon instantiation in `Cell#initialize` and `Cell.fast_create`.
25
+ - Restrict `Elements::Workbook#sheets`, `#sheet`, `#[]`, `#each`, and `#active_sheet` signatures to `Elements::Worksheet` instances only.
26
+ - Rename `Elements::Styles#num_fmt` to `number_format_code`.
27
+ - Rename `Elements::Dxf` member and keyword `:num_fmt` to `:number_format`.
28
+ - Rename `Elements::SheetProperties` member and keyword `:page_setup_pr` to `:page_setup_properties`.
29
+ - 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.).
30
+ - Return frozen `Elements::IgnoredError` value objects from `WorksheetBuilder#ignored_errors`, `StreamWriter#ignored_errors`, and `StreamWriter::WorksheetProxy#ignored_errors`.
31
+ - Encapsulate internal methods by making `StyleBuilder#resolve_color` and `StreamSheet#auto_filter_data` private.
32
+ - Update blockless `Xlsxrb.read` to return an `Enumerator[StreamSheet, void]` with managed zip container lifecycle; use `Xlsxrb.load` for in-memory random access.
33
+ - Update `WorkbookBuilder#sheet` and `StreamWriter#sheet` parameter signatures with explicit keyword arguments `state: nil, tab_color: nil, code_name: nil`.
34
+ - Update `StyleBuilder#border` and `StyleBuilder#alignment` parameter signatures with explicit keyword arguments.
35
+ - Synchronize `RubyLsp::Xlsxrb::CompletionListener` completion items with the canonical v0.2.0 API.
36
+ - Unify `Xlsxrb.array_formula` signature to remove optional positional `ref` in favor of keyword `ref:`.
37
+ - Rename `Elements::FilterColumn` member `:col_id` to `:column_id`.
38
+ - Rename `Elements::WorkbookProperties` member `:active_tab` to `:active_sheet`, and rename `Elements::Workbook#active_tab` to `#active_sheet_index`.
39
+ - Unify `Elements::Worksheet` constructor parameter `sheet_calc_pr:` to `sheet_calc_properties:` and simplify `#with` to canonical keyword arguments.
40
+ - 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.
41
+ - 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.
42
+ - 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`.
43
+ - 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.
44
+ - 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.
45
+ - 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.
46
+ - 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.
47
+ - 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`.
48
+
49
+ ### Removed
50
+ - Remove dead private helper `Xlsxrb.write_workbook`.
51
+ - Remove legacy `unmapped_data` fallbacks for `:style_index` in `Elements::Row#initialize`, and `:style_index`, `:style`, `:best_fit`, and `:collapsed` in `Elements::Column#initialize`.
52
+ - Hide non-`?` boolean member reader methods on all 28 `Elements::MetadataRecord` `Data.define` classes and `Elements::Formula#calculate_always`.
53
+ - 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`.
54
+ - 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`.
55
+ - Remove `WorkbookBuilder#hyperlink` and `WorkbookBuilder#comment` delegators (use top-level `Xlsxrb.hyperlink` and `Xlsxrb.comment`).
56
+ - 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`.
57
+ - Remove legacy rule `:size` fallback in `DslHelpers.extract_dxf_from_rule!` (retaining `:font_size`).
58
+ - 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:`).
59
+ - Remove in-memory `#close` on `Elements::Workbook` and `Elements::Worksheet`, and remove `#load` on `Elements::Worksheet` (`StreamSheet#close` and `StreamSheet#load` remain intact).
60
+ - 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`.
61
+ - Remove `Xlsxrb._read_workbook` and `Elements::Workbook#_load`.
62
+ - Remove deprecated alias `DslHelpers.sheet_name` in favor of `DslHelpers.sanitize_sheet_name`.
63
+ - Remove unused private cell serialization methods `build_raw_cell`, `build_row_attrs`, and `self.build_raw_cell_from_value` in `lib/xlsxrb.rb`.
64
+ - Remove empty `Xlsxrb::Utils` module and `lib/xlsxrb/utils.rb`.
65
+ - 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)`.
66
+ - 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`.
67
+ - Remove `show_symbols:` keyword argument from `outline_properties` across `WorksheetBuilder`, `StreamWriter`, and `WorksheetProxy` (unified to `show_outline_symbols:`).
68
+ - 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.
69
+ - 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`.
70
+ - 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)`.
71
+ - Remove `#[]`, `#[]=`, and `:in` fallback from `DataValidationBuilder` and `DslHelpers.normalize_data_validation`.
72
+ - Remove `#[]`, `#[]=`, `formulas`, `formulas=`, and fallbacks for `:size` and `:format_id` from `ConditionalFormatBuilder`.
73
+ - Remove `number_format_id` and `number_format_id=` from `StyleBuilder` in favor of `number_format` and `number_format=`.
74
+ - 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`).
75
+ - Remove all remaining deprecated builder methods and aliases across `WorkbookBuilder`, `WorksheetBuilder`, `StreamWriter`, and `StreamWriter::WorksheetProxy`:
76
+ - 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=`.
77
+ - Removed `ChartBuilder#secondary_axis`, `ChartBuilder#secondary_axis=`, and `SeriesBuilder#secondary_axis`.
78
+ - Removed deprecated methods on `StyleBuilder`: `size`, `size=`, `sz`, `sz=`, `num_fmt`, `num_fmt=`, `num_fmt_id`, `num_fmt_id=`.
79
+ - Removed deprecated methods on `TableBuilder`: `add_column`, `total_row`, `total_row=`, `total_row_count`, `total_row_count=`.
80
+ - Removed deprecated methods on `DataValidationBuilder`: `range`, `range=`, `col`, `col=`, `row`, `row=`, `in`, `in=`, `error`, `error=`, `prompt`, `prompt=`.
81
+ - Removed deprecated methods on `ConditionalFormatBuilder`: `range`, `range=`, `col`, `col=`, `row`, `row=`, `format_id`, `format_id=`, `size`, `size=`, `sz`, `sz=`.
82
+ - 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=`).
83
+ - 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:`).
84
+ - Remove `StreamWriter#shared_strings` reader method in favor of `shared_strings?`.
85
+ - Remove constant `Xlsxrb::MAX_COL` in favor of `Xlsxrb::MAX_COLUMN`.
86
+ - Remove `Xlsxrb::Error::DIV0`..`VALUE` cell error constants on the exception class in favor of `Elements::CellError::*`.
87
+ - Remove `Elements::RichTextRun#sz` in favor of `font_size`.
88
+ - Replace the `top_row` and `left_column` members of `Elements::FreezePane` and `Elements::SplitPane` with `top_left_cell`. Neither member was read or written.
89
+ - 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.
90
+ - 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`.
91
+ - 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`.
92
+ - 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).
93
+ - 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).
94
+ - 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?`).
95
+ - Remove keyword argument `date1904:` on `Cell#to_date` and `Cell#to_time`.
96
+ - Remove deprecated `StreamSheet#cell` and `Elements::Worksheet#cell` in favor of coordinate bracket access (`sheet[...]`).
97
+ - Remove deprecated `StreamSheet#first_row` and `StreamSheet#last_row` in favor of `row_range` or `dimension_bounds`.
98
+ - Remove deprecated `CoordinateAccess#cells_hash`, `first_column`, `first_col`, `last_column`, `last_col`, and `cell_value`.
99
+ - Remove deprecated `Elements::Image#cell` and `cell_ref` (use `ref`), `from_col` (use `from_column`), and `to_col` (use `to_column`).
100
+ - Remove remaining deprecated aliases, duplicate Data members, and initialization fallbacks across `Elements::*` Value Objects:
101
+ - 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`).
102
+ - Remove `Elements::RichTextRun#[]` and `other.is_a?(Hash)` branches from `Elements::Hyperlink#==`, `Elements::CustomProperty#==`, and `Elements::Styles#==`.
103
+ - 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 (`?`).
104
+ - Remove `Elements::Column#letter` in favor of canonical `column_letter`.
105
+ - Remove `Elements::Styles#format_code` in favor of `number_format`.
106
+ - Remove `StreamSheet#_load` in favor of `StreamSheet#load`.
107
+ - Remove deprecated `conditional_formatting:` and `col_breaks:` keyword arguments in `Elements::Worksheet#initialize` in favor of `conditional_formats:` and `column_breaks:`.
108
+ - 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`).
109
+ - Remove deprecated `Elements::Worksheet#dimension=` (use `with(dimension: ...)`), `Elements::Worksheet#with_images`, and `StreamSheet#with_images`.
110
+ - Remove deprecated `Elements::Worksheet#conditional_formatting` and `StreamSheet#conditional_formatting` in favor of `conditional_formats`.
111
+ - Remove deprecated `Elements::Styles#add_xf`, `add_num_fmt`, and `num_fmts` in favor of `add_cell_xf`, `add_number_format`, and `number_formats`.
112
+ - Remove deprecated `Elements::Styles#xf`, `num_fmt`, `format_code_for`, `classification_for`, and `sz`.
113
+ - 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.
114
+ - 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`).
115
+ - 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`.
116
+ - 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?`).
117
+
118
+ ### Fixed
119
+ - 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.
120
+ - 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.
121
+ - 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.
122
+ - 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.
123
+ - Write the `horizontalDpi` and `verticalDpi` attributes of page setup when they are positive; the schema requires at least 1.
124
+ - 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.
125
+ - Wrap keyword arguments with double splat in Data.define constructors across Elements to prevent heap corruption and segfaults in CRuby 4.0 Ractors.
126
+ - 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.
127
+ - 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`.
128
+ - 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`.
129
+ - 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.
130
+ - 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.
131
+ - 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.
132
+ - 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`.
133
+ - 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.
134
+ - Write the `sz` element of differential format fonts before `color` and `name`, in the order of `CT_Font`.
135
+ - 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.
136
+ - 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.
137
+ - 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.
138
+ - 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.
139
+ - 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.
140
+ - 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.
141
+ - 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.
142
+ - 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.
143
+ - 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.
144
+ - Keep the `family` and `scheme` of fonts loaded from `styles.xml`.
145
+ - 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.
146
+ - 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.
147
+ - 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.
148
+ - 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.
149
+ - Write `firstSliceAng` and `holeSize` in doughnut charts, 0 and 50 unless given; doughnut charts without them did not validate.
150
+ - 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`.
151
+ - 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.
152
+ - 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`.
153
+ - 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`.
154
+ - 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.
155
+ - 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`.
156
+ - 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.
157
+ - 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.
158
+ - 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.
159
+ - 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.
160
+ - 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).
161
+ - 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.
162
+ - 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).
163
+
1
164
  ## [0.1.18] - 2026-11-07
2
165
 
3
166
  ### 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!
@@ -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