xlsxrb 0.1.16 → 0.1.18

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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +157 -1
  3. data/README.md +81 -21
  4. data/lib/ruby_lsp/xlsxrb/completion_listener.rb +31 -61
  5. data/lib/xlsxrb/chart_builder.rb +619 -98
  6. data/lib/xlsxrb/dsl_helpers.rb +583 -15
  7. data/lib/xlsxrb/elements/cell.rb +265 -53
  8. data/lib/xlsxrb/elements/column.rb +95 -6
  9. data/lib/xlsxrb/elements/coordinate_access.rb +108 -10
  10. data/lib/xlsxrb/elements/image.rb +81 -15
  11. data/lib/xlsxrb/elements/metadata.rb +2733 -0
  12. data/lib/xlsxrb/elements/row.rb +130 -46
  13. data/lib/xlsxrb/elements/styles.rb +184 -76
  14. data/lib/xlsxrb/elements/types.rb +243 -7
  15. data/lib/xlsxrb/elements/workbook.rb +202 -65
  16. data/lib/xlsxrb/elements/worksheet.rb +728 -85
  17. data/lib/xlsxrb/elements.rb +1 -0
  18. data/lib/xlsxrb/ooxml/reader/listeners/core_listeners.rb +32 -3
  19. data/lib/xlsxrb/ooxml/reader/listeners/drawing_listeners.rb +194 -26
  20. data/lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb +372 -18
  21. data/lib/xlsxrb/ooxml/reader/listeners/style_listeners.rb +33 -14
  22. data/lib/xlsxrb/ooxml/reader.rb +92 -0
  23. data/lib/xlsxrb/ooxml/styles_parser.rb +29 -14
  24. data/lib/xlsxrb/ooxml/workbook_parser.rb +18 -3
  25. data/lib/xlsxrb/ooxml/workbook_writer.rb +351 -77
  26. data/lib/xlsxrb/ooxml/worksheet_parser.rb +18 -4
  27. data/lib/xlsxrb/ooxml/worksheet_writer.rb +349 -103
  28. data/lib/xlsxrb/ooxml/writer/drawing_xml.rb +584 -443
  29. data/lib/xlsxrb/ooxml/writer/features_xml.rb +52 -14
  30. data/lib/xlsxrb/ooxml/writer/styles_xml.rb +42 -18
  31. data/lib/xlsxrb/ooxml/writer.rb +288 -35
  32. data/lib/xlsxrb/ooxml/zip_generator.rb +2 -0
  33. data/lib/xlsxrb/ooxml/zip_reader.rb +47 -10
  34. data/lib/xlsxrb/ooxml/zip_writer.rb +15 -5
  35. data/lib/xlsxrb/stream_row.rb +97 -18
  36. data/lib/xlsxrb/stream_sheet.rb +827 -157
  37. data/lib/xlsxrb/stream_writer.rb +2766 -375
  38. data/lib/xlsxrb/style_builder.rb +821 -105
  39. data/lib/xlsxrb/utils.rb +82 -57
  40. data/lib/xlsxrb/version.rb +1 -1
  41. data/lib/xlsxrb/workbook_builder.rb +542 -62
  42. data/lib/xlsxrb/worksheet_builder.rb +2279 -209
  43. data/lib/xlsxrb.rb +1539 -344
  44. data/sig/generated/xlsxrb/chart_builder.rbs +336 -79
  45. data/sig/generated/xlsxrb/dsl_helpers.rbs +137 -4
  46. data/sig/generated/xlsxrb/elements/cell.rbs +104 -15
  47. data/sig/generated/xlsxrb/elements/column.rbs +62 -3
  48. data/sig/generated/xlsxrb/elements/coordinate_access.rbs +49 -7
  49. data/sig/generated/xlsxrb/elements/image.rbs +30 -8
  50. data/sig/generated/xlsxrb/elements/metadata.rbs +1587 -0
  51. data/sig/generated/xlsxrb/elements/row.rbs +61 -21
  52. data/sig/generated/xlsxrb/elements/styles.rbs +96 -58
  53. data/sig/generated/xlsxrb/elements/types.rbs +29 -0
  54. data/sig/generated/xlsxrb/elements/workbook.rbs +92 -44
  55. data/sig/generated/xlsxrb/elements/worksheet.rbs +259 -38
  56. data/sig/generated/xlsxrb/ooxml/reader/listeners/core_listeners.rbs +2 -0
  57. data/sig/generated/xlsxrb/ooxml/reader/listeners/drawing_listeners.rbs +74 -2
  58. data/sig/generated/xlsxrb/ooxml/reader/listeners/feature_listeners.rbs +97 -0
  59. data/sig/generated/xlsxrb/ooxml/reader/listeners/style_listeners.rbs +3 -0
  60. data/sig/generated/xlsxrb/ooxml/reader.rbs +20 -0
  61. data/sig/generated/xlsxrb/ooxml/styles_parser.rbs +3 -0
  62. data/sig/generated/xlsxrb/ooxml/workbook_parser.rbs +8 -0
  63. data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +8 -4
  64. data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +1 -1
  65. data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +12 -1
  66. data/sig/generated/xlsxrb/ooxml/writer/drawing_xml.rbs +16 -0
  67. data/sig/generated/xlsxrb/ooxml/writer.rbs +45 -8
  68. data/sig/generated/xlsxrb/ooxml/zip_generator.rbs +2 -0
  69. data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +2 -2
  70. data/sig/generated/xlsxrb/ooxml/zip_writer.rbs +8 -2
  71. data/sig/generated/xlsxrb/stream_row.rbs +48 -14
  72. data/sig/generated/xlsxrb/stream_sheet.rbs +398 -89
  73. data/sig/generated/xlsxrb/stream_writer.rbs +1601 -219
  74. data/sig/generated/xlsxrb/style_builder.rbs +403 -75
  75. data/sig/generated/xlsxrb/utils.rbs +49 -13
  76. data/sig/generated/xlsxrb/workbook_builder.rbs +308 -26
  77. data/sig/generated/xlsxrb/worksheet_builder.rbs +1142 -96
  78. data/sig/generated/xlsxrb.rbs +321 -52
  79. metadata +3 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7edcf69207f83781642d4628e25802bd9f25e6db4caac46c4419cc803c225d4c
4
- data.tar.gz: 6af71208f72dd6f2b94f4127faca05bce3046cd40c5a1ca9c605935eac754bad
3
+ metadata.gz: f63edc4ff06e7c40608175b89fbcb822f121bae1b485ea689885540806498bec
4
+ data.tar.gz: c26a8000287eb1ff23ffc6987be404dbc7a34ea1f634b3d063faac6481a57e81
5
5
  SHA512:
6
- metadata.gz: b52768fc57d885db35b14c793e451c99c60045d56e5dad8ff549108fd1b25c825b8ad49dfb98d70e8f17a4512542129aeec0d793f3ed1d148b5cbcd228493523
7
- data.tar.gz: d701b2f511498b462377ab7dcfcbe3288f331bd5e3df2c1c25c9a326abee7e5b1c6b583973f9afb5359a8affd158a33350aee186c4949055ea4d711e5db1a5fc
6
+ metadata.gz: a7980f5301fe23f6bc7577447d8d924ab6c17f2ad5f5849e9023b95cb74ac86a15d9c61d9113bbb7b4c517a8961a14e3f7c4b96e533f4e8fb6010897f21b5bed
7
+ data.tar.gz: cbf3e1bdee2d617da99c32c7a5ad8e4acb4d6cd81d6cc662b6d4d46783dd0592185c142d7a4d26ca0300b66478d93780e2fde45f6ad5e29deaec80910338e245
data/CHANGELOG.md CHANGED
@@ -1,4 +1,160 @@
1
- ## [Unreleased]
1
+ ## [0.1.18] - 2026-11-07
2
+
3
+ ### Added
4
+ - Add Value Object factory delegator methods (`formula`, `array_formula`, `shared_formula`, `rich_text`, `comment`, `cell_error`, `hyperlink`) across `WorkbookBuilder`, `WorksheetBuilder`, `StreamWriter`, and `StreamWriter::WorksheetProxy`.
5
+ - Add canonical coordinate conversion facade methods `Xlsxrb.parse_ref`, `Xlsxrb.cell_to_ref`, `Xlsxrb.column_index`, and `Xlsxrb.column_letter`.
6
+ - Add `Xlsxrb.format_value` as the canonical value formatting method.
7
+ - Add `Xlsxrb.time_to_serial` (and `Utils.time_to_serial`) for converting Time/Date objects to Excel numeric serial numbers.
8
+ - Add `Xlsxrb::MAX_COLUMN` constant (16,384) representing the maximum column count supported by Excel / OpenXML.
9
+ - Support passing nested bounding coordinate arrays `[[top_row, left_col], [bottom_row, right_col]]` (as returned by `parse_range`) to `Xlsxrb.range_to_ref`.
10
+ - Support `column_delta:` keyword in `Xlsxrb::Utils.expand_formula`.
11
+ - Support `ref:` keyword argument in `Xlsxrb.array_formula` and include `Elements::CellError` in `cached_value:` types.
12
+ - Support `new_password:` and writer/reader option forwarding in `Xlsxrb.modify`, and return the block result.
13
+ - Define Ractor-shareable frozen `Elements::CellError` constants (`DIV0`, `NA`, `NAME`, `NULL`, `NUM`, `REF`, `VALUE`, `GETTING_DATA`) on `Elements::CellError`.
14
+ - Add canonical cell-level and row-level style keywords `cell_styles:` and `row_style:` across `WorksheetBuilder#row`, `StreamWriter#row`, and `StreamWriter::WorksheetProxy#row`.
15
+ - Expose `:style_index` as a canonical `Data.define` member on `Elements::Row`.
16
+ - Add `style:` keyword to `Elements::Cell.new` and `Elements::Worksheet#update_cell` for style names and inline style definitions.
17
+ - Add 1-based `row_range` and `column_range` boundaries to `Elements::Worksheet` (via `CoordinateAccess`) and `StreamSheet` (from sheet dimension bounds), returning idiomatic `Range[Integer]` boundaries.
18
+ - Support 2D coordinate indexing `sheet[row, col]` and letter column indexing `sheet[row, "A"]` on `Elements::Worksheet` and `CoordinateAccess`.
19
+ - Add `column` and `columns` builder methods across `WorksheetBuilder`, `StreamWriter`, and `WorksheetProxy` with unified options.
20
+ - Support 0-based page break indices (`row_breaks`, `column_breaks`) across builders and readers.
21
+ - Add `Elements::WorkbookProperties#active_sheet` and `Elements::Workbook#active_sheet_index`.
22
+ - Add `Elements::FilterColumn#column_id`.
23
+ - Add structured Hash access for `category_axis` and `value_axis` titles on `Elements::Chart`.
24
+ - Add dedicated assignment setters returning assigned value (`active_sheet=`, `first_sheet=`, `show_sheet_tabs=`, `tab_ratio=`, `code_name=`, `fit_to_page=`, `tab_color=`, `phonetic_properties=`, `sheet_calc_properties=`, `background_image=`, `totals_row=`, `totals_row_count=`, `state=`, `print_area=`, `print_titles=`) across `WorkbookBuilder`, `WorksheetBuilder`, `StreamWriter`, and `StreamWriter::WorksheetProxy`.
25
+ - Add zero-argument property getters across builders and `StyleBuilder`.
26
+ - Add predicate methods (`bold?`, `italic?`, `strike?`, `wrap_text?`, `shrink_to_fit?`, `locked?`, `hidden?`, `superscript?`, `subscript?`) and assignment setters (`font=`, `fill=`, `border=`, `vert_align=`, `superscript=`, `subscript=`, `wrap_text=`, `shrink_to_fit=`, `locked=`, `hidden=`, `protection=`, `number_format=`) on `StyleBuilder`.
27
+ - Re-affirm `totals_row`, `totals_row=`, `totals_row_count`, and `totals_row_count=` as canonical on `TableBuilder` to align with ECMA-376 `totalsRowCount`.
28
+ - Promote reader metadata to immutable Data value objects across `Elements::Styles`, `Elements::Workbook`, and `Elements::Cell`.
29
+ - Add `Elements::Styles#number_format_code(id)`.
30
+ - Support Symbol sheet lookup in `Elements::Workbook#sheet` and `Elements::Workbook#[]`.
31
+ - Freeze `Elements::Cell` instances on instantiation (`initialize` and `fast_create`).
32
+ - Return frozen `Array[Elements::IgnoredError]` from `WorksheetBuilder#ignored_errors`, `StreamWriter#ignored_errors`, and `WorksheetProxy#ignored_errors`.
33
+ - Add XML element existence guards for `merged_cells`, `data_validations`, `conditional_formats` on `StreamSheet`.
34
+ - Establish four-pillar I/O architecture: `Xlsxrb.read`, `Xlsxrb.write`, `Xlsxrb.load`, and `Xlsxrb.build`.
35
+ - Direct worksheet materialization in `Xlsxrb.load` without intermediate `StreamSheet` allocations.
36
+ - Support on-demand zip reopen after close in `Ooxml::ZipReader`.
37
+ - Clarify `@api private` on `Ooxml::Reader`, `Ooxml::Writer`, and `Ooxml::ZipGenerator`.
38
+
39
+ ### Changed
40
+ - Update `Elements::Row#[]` and `StreamRow#[]` to resolve column indices and column letters via `cell_at` instead of indexing the raw sparse `cells` array, returning `nil` when a cell at the specified column is absent.
41
+ - Separate builder getter (`xxx`) and setter (`xxx=`) methods, allowing explicit `nil` resets.
42
+ - Encapsulate `StyleBuilder#resolve_color` as `private`.
43
+ - Encapsulate `StreamSheet#auto_filter_data` as `private`.
44
+ - Make `Xlsxrb._read_workbook` `private_class_method`.
45
+
46
+ ### Deprecated
47
+ - `DslHelpers.sheet_name` is deprecated in favor of `DslHelpers.sanitize_sheet_name`; will be removed in version 0.2.0.
48
+ - Positional `pos_ref` in `Xlsxrb.array_formula` is deprecated in favor of keyword `ref:`; will be removed in version 0.2.0.
49
+ - Top-level aliases `Xlsxrb.stream`, `Xlsxrb.sheet_name`, `Xlsxrb.color_to_hex`, `Xlsxrb.serial_to_datetime`, and `Xlsxrb::Utils.serial_to_datetime` are deprecated in favor of `Xlsxrb.read`, `Xlsxrb.sanitize_sheet_name`, `Xlsxrb.to_hex_color`, and `Xlsxrb.serial_to_time`; will be removed in version 0.2.0.
50
+ - `Xlsxrb.format` is deprecated in favor of `Xlsxrb.format_value`; will be removed in version 0.2.0.
51
+ - `Xlsxrb.datetime_to_serial` and `Xlsxrb::Utils.datetime_to_serial` are deprecated in favor of `Xlsxrb.time_to_serial`; will be removed in version 0.2.0.
52
+ - `Xlsxrb::MAX_COL` is deprecated in favor of `Xlsxrb::MAX_COLUMN`; will be removed in version 0.2.0.
53
+ - `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`) and `Elements::Cell.column_index`, `column_letter`, `parse_ref` are deprecated in favor of top-level `Xlsxrb.*` helpers; will be removed in version 0.2.0.
54
+ - Keyword `:col_delta` in `Xlsxrb::Utils.expand_formula` is deprecated in favor of `:column_delta`; will be removed in version 0.2.0.
55
+ - Keyword `:si` in `Xlsxrb.shared_formula` is deprecated in favor of `:shared_index`; will be removed in version 0.2.0.
56
+ - `Xlsxrb::Error::DIV0`..`VALUE` cell error constants on the exception class are deprecated in favor of `Elements::CellError::DIV0`..`VALUE`; will be removed in version 0.2.0.
57
+ - Redundant method and setter aliases across builders and element readers (`add_row`, `skip_row`, `group_column`, `group_cols`, `group_col`, `group_row`, `outline_pr`, `add_threaded_comment`, `background_picture`, `picture`, `background_picture=`, `picture=`, `add_protected_range`, `add_cell_watch`, `phonetic_pr`, `phonetic_pr=`, `set_default_font`, `add_column`, `first_col`, `last_col`, `range`, `range=`, `col`, `col=`, `row`, `row=`, `sz`, `sz=`, `error`, `error=`, `prompt`, `prompt=`) are deprecated and will be removed in version 0.2.0.
58
+ - Singular `column:` and `row:` keywords in `defined_name` are deprecated in favor of plural `columns:` and `rows:`; will be removed in version 0.2.0.
59
+ - `show_symbols:` keyword in `outline_properties` is deprecated in favor of `show_outline_symbols:`; will be removed in version 0.2.0.
60
+ - `fit_to_page?` on builders is deprecated in favor of `fit_to_page`; will be removed in version 0.2.0.
61
+ - Keywords `styles:` and `style:` on `WorksheetBuilder#row`, `StreamWriter#row`, and `WorksheetProxy#row` are deprecated in favor of `cell_styles:` and `row_style:`; will be removed in version 0.2.0.
62
+ - Passing non-Integer style names or Hash definitions to `style_index:` on `Elements::Cell.new` and `Elements::Worksheet#update_cell` is deprecated in favor of `style:`; will be removed in version 0.2.0.
63
+ - `Elements::Worksheet#cell` is deprecated in favor of bracket access (`sheet["A1"]` or `sheet[row, col]`) and will be removed in version 0.2.0.
64
+ - `StreamSheet#cell` is deprecated in favor of materializing an `Elements::Worksheet` via `sheet.load` and using coordinate bracket access; will be removed in version 0.2.0.
65
+ - `StreamSheet#first_row` and `StreamSheet#last_row` returning integer row numbers are deprecated in favor of `row_range` or `dimension_bounds`; will be removed in version 0.2.0.
66
+ - Passing coordinate keyword arguments (`row:`, `col_start:`, `col_end:`, `row_start:`, `row_end:`) to `merge` on `WorksheetBuilder`, `StreamWriter`, and `WorksheetProxy` is deprecated in favor of coordinate range strings (e.g. `"A1:C1"`); coordinate kwargs will be removed in version 0.2.0.
67
+ - `Elements::FilterColumn#col_id` is deprecated in favor of `#column_id`; will be removed in version 0.2.0.
68
+ - `Elements::WorkbookProperties#active_tab` is deprecated in favor of `#active_sheet`, and `Elements::Workbook#active_tab` is deprecated in favor of `#active_sheet_index`; will be removed in version 0.2.0.
69
+ - `Elements::Chart#cat_axis_title` and `#val_axis_title` are deprecated in favor of `category_axis[:title]` and `value_axis[:title]`; will be removed in version 0.2.0.
70
+ - `Elements::Worksheet` constructor keywords `sheet_calc_pr:`, `calc_pr:`, `phonetic_pr:`, `background_picture:`, `picture:` are deprecated in favor of canonical keyword arguments; will be removed in version 0.2.0.
71
+ - Calling builder getter methods with arguments to set values or mutate state (`active_sheet`, `first_sheet`, `show_sheet_tabs`, `tab_ratio`, `code_name`, `tab_color`, `sheet_calc_properties`, `phonetic_properties`, `background_image`, `state`, and subbuilders `TableBuilder`, `DataValidationBuilder`, `ConditionalFormatBuilder`) is deprecated and will become 0-argument getters in version 0.2.0; use dedicated setters (`xxx=`) instead.
72
+ - Calling `fit_to_page` with arguments is deprecated and will become a 0-argument boolean getter in version 0.2.0; use `fit_to_page = true/false` or `page_setup(fit_to_width: ..., fit_to_height: ...)` instead.
73
+ - Calling `StyleBuilder` boolean mutator methods (`bold`, `italic`, `underline`, `strike`, `superscript`, `subscript`, `wrap_text`, `shrink_to_fit`, `locked`, `hidden`) with zero arguments to mutate state is deprecated; pass `true` explicitly (e.g. `bold(true)`).
74
+ - `TableBuilder#[]` and `#[]=` are deprecated in favor of `#column(name)` and `#add_column`; will be removed in version 0.2.0.
75
+ - `TableBuilder#total_row`, `#total_row=`, `#total_row_count`, and `#total_row_count=` are deprecated in favor of `totals_row`, `totals_row=`, `totals_row_count`, and `totals_row_count=`; will be removed in version 0.2.0.
76
+ - `Elements::Styles#num_fmt` is deprecated in favor of `Styles#number_format_code`; will be removed in version 0.2.0.
77
+ - `Elements::Dxf#num_fmt` is deprecated in favor of `Dxf#number_format`; will be removed in version 0.2.0.
78
+ - `Elements::SheetProperties#page_setup_pr` is deprecated in favor of `SheetProperties#page_setup_properties`; will be removed in version 0.2.0.
79
+ - `StreamSheet#first_column` and `StreamSheet#last_column` are deprecated in favor of `column_range`; will be removed in version 0.2.0.
80
+ - `StreamSheet#sheet_views`, `#first_column_index`, `#last_column_index`, `#legacy_drawing`, and `#ext_lst` are deprecated in favor of `#sheet_view` and `#column_range`; will be removed in version 0.2.0.
81
+ - `Elements::Worksheet#conditional_formatting` and `StreamSheet#conditional_formatting` are deprecated in favor of `conditional_formats`; will be removed in version 0.2.0.
82
+ - `Elements::Row#to_a` and `StreamRow#to_a` returning cell values are deprecated in favor of `row.values`; in version 0.2.0, `to_a` will return `Array[Elements::Cell]` to conform to `Enumerable#to_a`.
83
+ - 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`) are deprecated in favor of `?`-suffixed methods (`trim_empty_rows?`, `pad_empty_rows?`, `pad_empty_cells?`, `fit_to_page?`, `show_sheet_tabs?`, `full_calc_on_load?`); will be removed in version 0.2.0.
84
+ - Transitional aliases `to_workbook` on `Workbook`, `to_worksheet` on `Worksheet` and `StreamSheet`, and `each_sheet` on `Workbook` are deprecated in favor of `load` and `each`; will be removed in version 0.2.0.
85
+ - Style aliases `Styles#xf`, `Styles#format_code_for`, `Styles#classification_for`, and `StyleBuilder#num_fmt` are deprecated in favor of `cell_xf`, `number_format`, and `format_type`; will be removed in version 0.2.0.
86
+ - `Xlsxrb.modify` is deprecated in favor of explicit `Xlsxrb.load` -> mutate -> `Xlsxrb.write` pipeline; will be removed in version 0.2.0.
87
+ - `Xlsxrb.write_workbook` and `Xlsxrb.workbook_to_data` are deprecated in favor of `Xlsxrb.write`; will be removed in version 0.2.0.
88
+ - In-memory `Elements::Workbook#close`, `Elements::Worksheet#close`, and `Elements::Worksheet#load` are deprecated; will be removed in version 0.2.0 (`StreamSheet#close` and `StreamSheet#load` remain supported).
89
+ - Returning non-`Elements::Workbook` values from `Xlsxrb.modify` blocks is deprecated and will raise `TypeError` in version 0.2.0.
90
+
91
+ ### Fixed
92
+ - Prevent attribute loss in `Elements::PivotTable`, `Elements::TableColumn`, `Elements::ThreadedComment`, `Elements::Comment`, and `Elements::FilterColumn` by retaining full schema attributes and capturing unmapped keyword options into `options:`.
93
+ - Eliminate internal calls to deprecated `MetadataRecord#[]`, `#merge`, and `cols:` across `WorksheetBuilder`, `WorkbookBuilder`, `StreamSheet`, `Elements::Worksheet`, and `Elements::Styles`.
94
+
95
+ ## [0.1.17] - 2026-11-01
96
+
97
+ ### Added
98
+ - Support threaded comments (`<ThreadedComments>`) and workbook person lists (`<personList>`) across `WorksheetBuilder`, `StreamWriter`, `WorksheetProxy`, `Ooxml::Writer`, `WorkbookWriter`, `DrawingXml`, `Elements::Worksheet`, `Elements::Cell`, `StreamSheet`, and `Ooxml::Reader`, serialize `xl/threadedComments/threadedComment{N}.xml` and `xl/persons/person.xml` conforming to the OpenXML threaded comments specification, support root comments and replies with `parent_id`, timestamps, and resolution states (`done`), register relationship types and content types, and provide query accessors across worksheets and cells.
99
+ - Support combo charts and secondary value axes across `ChartBuilder`, `DrawingXml`, `Ooxml::Writer`, and `DrawingListeners`, allow mixed chart types (e.g. bar and line) inside a single plot area with primary and secondary value axes (`secondary_value_axis:`, `secondary_axis:`), support per-series axis binding via `SeriesBuilder#secondary_axis` and `SeriesBuilder#axis`, serialize distinct `<c:valAx>` elements with independent scaling, orientation, units, and gridlines conforming to ECMA-376 Part 4 §21.2 schema sequence, and expose secondary value axis configurations in `Ooxml::Reader`.
100
+ - Support shared formula (`<f t="shared">`) serialization and reader expansion across `Xlsxrb.shared_formula`, `Xlsxrb.formula(..., shared_index:, si:)`, `WorksheetWriter`, `FeaturesXml`, `WorksheetParser`, and `WorksheetListener`, serialize master (`ref`, `si`) and follower (`si`) elements conforming to ECMA-376 Part 4 §18.3.1.40, and add `Xlsxrb::Utils.expand_formula` to expand relative cell references across shared formula ranges during SAX and streaming parsing.
101
+ - Support table calculated columns (`calculatedColumnFormula`) and custom totals row formulas (`totalsRowFormula`) across `TableBuilder`, `DslHelpers.normalize_table_options`, `WorkbookWriter`, `Writer`, and `FeatureListeners`, add `TableBuilder#calculated_column` helper, support `formula:`, `data_formula:`, `totals_row_formula:`, `total_row_formula:`, and `total_formula:` aliases, automatically infer `totalsRowFunction="custom"` when a totals formula is provided without an explicit function, and expose `calculated_column_formula` and `data_formula` in reader output.
102
+ - Support font text decoration attributes, including underline styles (`:single`, `:double`, `:single_accounting`, `:double_accounting`, `:none`) and vertical alignment (`:superscript`, `:subscript`, `:baseline`), with dedicated builder helpers (`superscript`, `subscript`, `vert_align`, `underline`) and option mappings across `StyleBuilder`, `WorkbookWriter`, `StylesXml`, `FeaturesXml`, `WorksheetWriter`, and `Ooxml::Reader`.
103
+ - Support row and column grouping DSL (`group_rows`, `group_columns`, `group_row`, `group_column`, `group_cols`, `group_col`) and outline view properties (`outline_properties`, `outline_pr`) across `WorksheetBuilder`, `StreamWriter`, `WorksheetProxy`, `Elements::Worksheet`, `StreamSheet`, and `Ooxml::Reader`, emit schema-compliant `<outlinePr applyStyles="..." summaryBelow="..." summaryRight="..." showOutlineSymbols="..."/>` in `WorksheetWriter`, and emit `collapsed="1"` on `<col>` elements.
104
+ - Enhance conditional formatting with statistical and relative rules (`above_average`, `top10`, `duplicate_values`, `unique_values`, `contains_blanks`, `not_contains_blanks`, `contains_errors`, `not_contains_errors`, `time_period`), add builder accessors (`above_average`, `equal_average`, `std_dev`, `rank`, `percent`, `bottom`, `text`, `time_period`) to `ConditionalFormatBuilder`, map symbol time periods (`:today`, `:last_7_days`, `:this_month`, etc.) to ECMA-376 `ST_TimePeriod` values, and automatically infer rule type from options.
105
+ - Add `ConditionalFormatBuilder` supporting block configuration for conditional formatting across `WorksheetBuilder`, `StreamWriter`, `WorksheetProxy`, and `Ooxml::Writer`.
106
+ - Add coordinate targeting (`columns:`, `rows:`, `col:`, `row:`, `except_rows:`) to `conditional_format` and `ConditionalFormatBuilder`, symmetrically resolving to `sqref`.
107
+ - Enhance `color_scale` conditional formatting with automatic cfvo generation for 2-color (`min`/`max`) and 3-color (`min`/50%/`max`) scales, and auto-normalize 6-digit RGB hex colors to 8-digit ARGB.
108
+ - Enhance `icon_set` conditional formatting with automatic cfvo percent distribution for 3, 4, and 5 icon sets, and support symbol icon set styles (`:three_arrows`, `:four_rating`, `:five_quarters`, etc.).
109
+ - Enhance `table` and `TableBuilder` with `auto_filter:` option, boolean `total_row` / `totals_row` helpers, symbol column names, and symbol `totals_row_function` mappings (`:sum`, `:average`, `:count`, `:min`, `:max`, `:count_nums`, `:std_dev`, `:var`, `:custom`).
110
+ - Add worksheet name sanitization utility via `Xlsxrb.sanitize_sheet_name` (aliased as `Xlsxrb.sheet_name` and `DslHelpers.sanitize_sheet_name`), sanitizing forbidden characters (`\`, `/`, `?`, `*`, `[`, `]`, `:`, control characters), replacing leading/trailing apostrophes, appending `replace_char` to the reserved `History` sheet name, and truncating names to 31 characters.
111
+ - Add `sheet_names` to `StreamWriter`, `WorksheetProxy`, and `WorkbookBuilder` returning an array of worksheet names currently registered in the workbook.
112
+ - Support `sheet.defined_name` symmetrically across `WorksheetBuilder`, `StreamWriter`, and `WorksheetProxy`, automatically quoting sheet names with single quote escaping and generating absolute `$` coordinate references.
113
+ - Support `fill: { color: ... }` and `fill_color:` in conditional formatting rules and `extract_dxf_from_rule!`.
114
+ - Support `size:` alongside `sz:` in conditional formatting differential formatting (`dxf`) fonts.
115
+ - Support `base_font:` in `Xlsxrb.rich_text(*runs, base_font: ...)` to merge base font attributes across text runs.
116
+ - Support `size:` alongside `sz:` in `RichTextRun`, inline rich text, and shared strings XML fonts.
117
+ - Add coordinate-based targeting (`columns:`, `rows:`, `except_rows:`, `col:`, `row:`) to `validate_data` and `DataValidationBuilder` with interval run compression (`compress_runs`), complement calculation (`complement_runs`), and automatic chunking into multiple `<dataValidation>` entries when reference counts exceed 32,767 (`Xlsxrb::MAX_REFS_PER_VALIDATION`).
118
+ - Expose spreadsheet dimension limits `Xlsxrb::MAX_ROW = 1_048_576`, `Xlsxrb::MAX_COL = 16_384`, and `Xlsxrb::MAX_REFS_PER_VALIDATION = 32_767`.
119
+ - Support direct array in `validate_data(..., in: [...])` converting to `type: "list"` with quoted CSV `formula1`.
120
+ - Automatically infer `show_input_message: true` when `prompt:` or `prompt_title:` is provided, infer `show_error_message: true` when `error:` or `error_title:` is provided, and convert multiline prompts and errors (`\r\n`, `\n`) to OOXML `ST_Xstring` format (`_x000a_`).
121
+ - Support explicit `:default` / `:none` cell style identifier to emit `s="0"` and prevent unintended column style inheritance.
122
+ - Merge duplicate `sheet.column` definitions on the same column index and sort by column index in in-memory and streaming modes.
123
+ - Inherit `sheet_format[:default_col_width]` when a column defines `style:` without explicit `width:`.
124
+ - Support sheet visibility states (`state:` `:visible`, `:hidden`, `:very_hidden`, and `hidden: true`) across `StreamWriter#sheet`, `WorksheetProxy`, and `WorkbookBuilder#sheet`, propagate state into streaming workbook XML, reject invalid state values with `ArgumentError`, and enforce that at least one visible worksheet exists in `strict_excel_mode`.
125
+ - Add active sheet and workbook view configuration (`active_sheet`, `first_sheet`, `show_sheet_tabs`, `tab_ratio`, and `sheet(..., active: true)`) across `WorkbookBuilder`, `StreamWriter`, and `WorksheetProxy`, resolve active tab indices safely to avoid hidden sheet selection, emit `activeTab`, `firstSheet`, `showSheetTabs`, and `tabRatio` on `<workbookView>`, guarantee single `tabSelected="1"` emission on the active sheet, and expose `active_tab`, `active_sheet`, `first_sheet`, `show_sheet_tabs?`, and `tab_ratio` on `Elements::Workbook`.
126
+ - Enhance worksheet tab color configuration (`tab_color`) across `WorksheetBuilder`, `StreamWriter`, and `WorksheetProxy` with support for RGB hex strings, theme colors, tint, indexed colors, and auto color, emit full `<tabColor>` attributes in `WorksheetWriter` and `Ooxml::Writer`, and expose `tab_color` readers on `Elements::Worksheet` and `StreamSheet`.
127
+ - Support worksheet error check warning suppression rules (`<ignoredErrors>`) via `ignore_error` and `add_ignored_error` across `WorksheetBuilder`, `StreamWriter`, and `WorksheetProxy`, emit schema-compliant `<ignoredErrors>` elements in `WorksheetWriter`, and expose `ignored_errors` readers on `Elements::Worksheet` and `StreamSheet` with full round-trip preservation.
128
+ - Support worksheet phonetic (furigana) guide properties (`<phoneticPr>`) via `phonetic_properties` (and alias `phonetic_pr`) across `WorksheetBuilder`, `StreamWriter`, and `WorksheetProxy`, emit schema-compliant `<phoneticPr>` elements in `WorksheetWriter` and `WorkbookWriter` in Part 4 schema sequence position, and expose `phonetic_properties` query readers on `Elements::Worksheet` and `StreamSheet` with full round-trip preservation.
129
+ - Support workbook and worksheet code names (`code_name`), page setup fit-to-page linkage (`fit_to_page`, `fit_to_page?`), and worksheet calculation properties (`sheet_calc_pr`, `full_calc_on_load?`) across `WorkbookBuilder`, `WorksheetBuilder`, `StreamWriter`, and `WorksheetProxy`, emit schema-compliant `codeName` on `<workbookPr>` and `<sheetPr>`, emit `<pageSetUpPr fitToPage="1"/>` and `<sheetCalcPr fullCalcOnLoad="1"/>` in `WorksheetWriter` conforming to ECMA-376 Part 4 schema sequence, and expose query methods and properties on `Elements::Workbook`, `Elements::Worksheet`, and `StreamSheet` with full round-trip fidelity.
130
+ - Support worksheet background image (`<picture r:id="..."/>`) via `background_image` (with aliases `background_picture`, `picture`, `background_image=`, `background_picture=`, `picture=`) across `WorksheetBuilder`, `StreamWriter`, and `WorksheetProxy`, serialize relationship in `xl/worksheets/_rels/sheet{N}.xml.rels` and binary media in `xl/media/sheet{N}_bg.{ext}`, register image extension in `[Content_Types].xml`, emit schema-compliant `<picture>` element in `WorksheetWriter` conforming to ECMA-376 Part 4 schema sequence, and expose `background_image` query readers on `Elements::Worksheet` and `StreamSheet` with full round-trip fidelity.
131
+ - Add visual regression test example, Visual Gallery section, and WebAssembly Live Playground preset for worksheet views and advanced properties (`sheet_properties`).
132
+ - Support hierarchical differential format Hash (`dxf: { font: ..., fill: ... }`) in `conditional_format` and `add_conditional_format` across `StreamWriter`, `WorksheetProxy`, `WorksheetBuilder`, and `Ooxml::Writer` with automatic deduplication, emit `<b val="0"/>`, `<i val="0"/>`, `<strike val="0"/>` on boolean `false` font properties, and support automatic/theme/tint font and background colors and `pattern: "none"` pattern fills.
133
+ - Add `skip_rows` (and alias `skip_row`) to `StreamWriter`, `WorksheetProxy`, and `WorksheetBuilder` to advance the row cursor without writing empty `<row>` XML elements.
134
+ - Support configurable workbook-wide default font (`default_font: { name:, size: }`, `default_font(name, size, **opts)`, `set_default_font`) across `StreamWriter`, `WorksheetProxy`, `WorkbookBuilder`, `Xlsxrb.write`, and `Xlsxrb.build`, serializing name, size, family, charset, and scheme onto the base font (font 0).
135
+ - Support inline strings option (`shared_strings: false`) across `StreamWriter` and `Xlsxrb.write`, writing cells directly as `<c t="inlineStr"><is><t>...</t></is></c>` and omitting `xl/sharedStrings.xml` and package relationships to maintain flat $O(1)$ constant memory during streaming write.
136
+ - Support configurable ZIP deflate compression level (`compression_level: 0..9`) across `StreamWriter`, `Ooxml::ZipWriter`, `Ooxml::WorkbookWriter`, and `Xlsxrb.write`, allowing performance tuning between compression speed (e.g. level 4 for 20-40% faster writes) and archive size.
137
+
138
+ ### Changed
139
+ - Unify differential format extraction across `WorkbookWriter` and `StreamWriter` into centralized `DslHelpers.extract_dxf_from_rule!`.
140
+ - Synchronize mutation testing metrics in `README.md`, `docs/MUTATION_TESTING.md`, and `docs/QUALITY_ASSURANCE.md` to reflect 51 pure functional subjects and 2,549 mutations at 100.00% kill rate.
141
+ - Optimize `bin/pre-push` and test suite execution time:
142
+ - Scope mutation testing (`rake mutant:pure`) to subjects and test files matching changed files via `MUTANT_FILES` (running only affected pure logic subjects in ~2-20s rather than all 51 subjects), falling back to full coverage when `Rakefile` or `.mutant.yml` changes or when `--force` is passed, and suppressing parser future-frozen string warnings during mutation runs.
143
+ - Eliminate duplicate `rake sig` invocation in `bin/pre-push` (already invoked as a prerequisite of `rake typecheck`) and run unit and contract tests in a single `rake test` process rather than two separate test processes.
144
+ - Decouple serial RBS runtime type validation (`test:rbs`) from default local `bin/pre-push --all` (saving ~160s locally where static Steep type checking already ensures zero errors), while preserving automated runtime type validation on CI and allowing manual execution with `bin/pre-push --all --rbs` or `RUN_RBS=1`.
145
+ - Condition SimpleCov coverage profiling on `ENV["COVERAGE"] == "1"` or `ENV["CI"] == "true"`, eliminating 5-10s of instrumentation overhead during local test runs.
146
+ - Replace anonymous keyword argument forwarding (`**`) in `StreamWriter` and `WorksheetBuilder` with explicit `**opts` to prevent Steep 2.1.0 internal `RuntimeError` crashes during type synthesis.
147
+ - Update `bin/setup` to install `.git/hooks/pre-push` as a wrapper forwarding directly to `bin/pre-push --all`, ensuring `git push` runs extended diff-scoped mutation verification while staying synchronized with `bin/pre-push`.
148
+
149
+ ### Fixed
150
+ - Guard `Ooxml::Writer#generate_table_xml` against `TypeError` when `tbl[:style]` is provided as a string, and resolve table style attributes (`show_first_column`, `show_last_column`, `show_row_stripes`, `show_column_stripes`) directly from table definition root.
151
+ - Omit `<autoFilter>` tag from table XML when `auto_filter: false` is explicitly specified across `Ooxml::Writer` and `WorkbookWriter`.
152
+ - Enforce strict Excel worksheet name rules in `StreamWriter#sheet`, `WorkbookBuilder#sheet`, and `Elements::Worksheet.valid_name?` / `validate`, rejecting colons (`:`), leading/trailing apostrophes (`'`), and the case-insensitive reserved name `History`, updating validation error messages to reference Excel constraints.
153
+ - Guard against non-finite Float values (`Float::INFINITY`, `Float::NAN`, and non-finite cached formula values) in `StreamWriter#row` and `WorksheetWriter#write_row_values`, raising `ArgumentError` to prevent corrupt XML output.
154
+ - Support `xsd:boolean` representations (`"true"`, `"false"`, `"1"`, `"0"`) across `StylesParser`, `StylesListener`, and column definitions in `WorksheetParser`.
155
+ - Safely handle `nil` shared strings table index (`sst_index: nil`) across unstyled fast path and general cell paths in `WorksheetWriter#write_row_values`, writing string values as inline strings (`t="inlineStr"`) without error.
156
+ - Include `test/ooxml/**/*_test.rb` in Rake test tasks and update custom number format assertions to use `Elements::Styles#num_fmt`.
157
+ - Preserve formatted text runs (`<r><rPr>...</rPr><t>...</t></r>`) in inline strings (`<c t="inlineStr">`) for `Elements::RichText` cells across unstyled fast path and general row paths in `WorksheetWriter#write_row_values` when `shared_strings: false` is used.
2
158
 
3
159
  ## [0.1.16] - 2026-10-24
4
160
 
data/README.md CHANGED
@@ -40,7 +40,7 @@ Maintaining a gem that supports both reading and writing across streaming and in
40
40
 
41
41
  ### Autonomous Quality Assurance
42
42
 
43
- To maintain its multi-layered QA suite (Steep static typing, 100% mutation kill rate across 43 subjects, ECMA-376 XSD validation, and $O(1)$ streaming memory) without high manual maintenance overhead, xlsxrb defines remediation workflows for AI coding agents ([AGENTS.md](AGENTS.md), [docs/QA_AGENTS.md](docs/QA_AGENTS.md)).
43
+ To maintain its multi-layered QA suite (Steep static typing, 100% mutation kill rate across 51 subjects, ECMA-376 XSD validation, and $O(1)$ streaming memory) without high manual maintenance overhead, xlsxrb defines remediation workflows for AI coding agents ([AGENTS.md](AGENTS.md), [docs/QA_AGENTS.md](docs/QA_AGENTS.md)).
44
44
 
45
45
  ## Installation
46
46
 
@@ -63,9 +63,37 @@ You can also browse 80+ rendered visual examples across all features in the [Vis
63
63
 
64
64
  ## Usage
65
65
 
66
- ### Quick Start: Streaming (Recommended for Large Files)
66
+ ### I/O Architecture Matrix
67
+
68
+ xlsxrb provides four canonical entry points organized along two axes:
69
+
70
+ | Axis | Streaming ($O(1)$ Memory) | In-Memory (Full Random Access) |
71
+ | :--- | :--- | :--- |
72
+ | Read / Input | `Xlsxrb.read(source) { \|sheet\| ... }` | `Xlsxrb.load(source) -> Elements::Workbook` |
73
+ | Write / Output | `Xlsxrb.write(dest) { \|writer\| ... }` | `Xlsxrb.build { \|builder\| ... } -> Elements::Workbook` |
74
+
75
+ ---
76
+
77
+ ### Streaming Read ($O(1)$ Memory)
78
+
79
+ Iterates rows sequentially without loading the full document into memory. Closes the underlying archive automatically upon block completion:
80
+
81
+ ```ruby
82
+ require "xlsxrb"
83
+
84
+ Xlsxrb.read("large_file.xlsx") do |sheet|
85
+ sheet.each_row do |row|
86
+ row.each_cell do |cell|
87
+ puts "#{cell.ref}: #{cell.value}"
88
+ end
89
+ end
90
+ end
91
+ ```
92
+
93
+ ### Streaming Write (Low Memory)
94
+
95
+ Pipes row and cell XML directly to the archive without buffering rows in memory:
67
96
 
68
- #### Streaming Write (Low Memory)
69
97
  ```ruby
70
98
  require "xlsxrb"
71
99
 
@@ -78,25 +106,25 @@ Xlsxrb.write("large_output.xlsx") do |writer|
78
106
  end
79
107
  ```
80
108
 
81
- > [!NOTE]
82
- > Streaming writes pipe row and cell XML directly to the archive without buffering rows, keeping cell data memory constant. Because shared strings are indexed across the workbook to minimize output file size, memory scales with the count of distinct strings.
109
+ ### In-Memory Load (Full Random Access)
110
+
111
+ Parses the workbook into an immutable document model (`Elements::Workbook`) and immediately closes the underlying file:
83
112
 
84
- #### Streaming Read ($O(1)$ Memory)
85
113
  ```ruby
86
114
  require "xlsxrb"
87
115
 
88
- Xlsxrb.read("large_file.xlsx") do |sheet|
89
- sheet.each_row do |row|
90
- row.each_cell do |cell|
91
- puts "#{cell.ref}: #{cell.value}"
92
- end
93
- end
94
- end
116
+ wb = Xlsxrb.load("workbook.xlsx")
117
+ sheet = wb["Sheet1"]
118
+
119
+ puts sheet["A1"].value
120
+ puts sheet.page_setup.orientation
121
+ puts sheet.hyperlinks["B2"].url
95
122
  ```
96
123
 
97
- ### In-Memory Building & Modifying
124
+ ### In-Memory Build (Document Creation)
125
+
126
+ Constructs an in-memory `Elements::Workbook` using the declarative builder DSL:
98
127
 
99
- #### Creating & Exporting (Rails / Mailers)
100
128
  ```ruby
101
129
  require "xlsxrb"
102
130
 
@@ -112,18 +140,50 @@ Xlsxrb.write("report.xlsx", wb)
112
140
  binary_data = Xlsxrb.write(wb)
113
141
  ```
114
142
 
115
- #### Modifying an Existing File
143
+ ---
144
+
145
+ ### Constant-Memory Streaming Transformation
146
+
147
+ To transform or filter data from an existing spreadsheet, stream rows from reader to writer in $O(1)$ memory:
148
+
116
149
  ```ruby
117
150
  require "xlsxrb"
118
151
 
119
- Xlsxrb.modify("template.xlsx", "output.xlsx") do |workbook|
120
- workbook.update_sheet("Invoice") do |sheet|
121
- sheet.update_cell("C4", value: "INV-10042")
122
- .update_cell("C5", value: Date.today)
152
+ Xlsxrb.write("output.xlsx") do |out_wb|
153
+ out_wb.sheet("Processed") do |out_sheet|
154
+ Xlsxrb.read("input.xlsx") do |in_sheet|
155
+ 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 })
157
+ end
158
+ end
123
159
  end
124
160
  end
125
161
  ```
126
162
 
163
+ ---
164
+
165
+ ### Template Migration & AI Code Generation
166
+
167
+ > [!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.
169
+
170
+ 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
+
172
+ ```ruby
173
+ require "xlsxrb"
174
+
175
+ wb = Xlsxrb.load("template.xlsx")
176
+ sheet = wb.sheets.first
177
+
178
+ # Inspect layout, formulas, and column widths
179
+ puts "Columns: #{sheet.columns.map { |c| [c.index, c.width] }}"
180
+ puts "Merged: #{sheet.merged_cells}"
181
+ puts "Formulas: #{sheet.rows.flat_map(&:cells).select(&:formula?).map { |c| [c.ref, c.formula] }}"
182
+ ```
183
+
184
+ **Recommended AI Prompt for Template Migration:**
185
+ > "Convert this Excel template into an `Xlsxrb.write` builder script using xlsxrb DSL methods (`row`, `column`, `merge`, `style`, `formula`). Ensure cell styles, column widths, number formats, and formulas match the inspected template layout."
186
+
127
187
  ### Password Protection & Encryption ([MS-OFFCRYPTO])
128
188
 
129
189
  Natively supports reading and writing encrypted XLSX files (Standard & Agile Encryption) with zero external C-extensions:
@@ -192,7 +252,7 @@ Verified by a multi-layered QA architecture:
192
252
  * Microsoft Open XML SDK Validation: Validates generated OOXML structures against Microsoft's official SDK.
193
253
  * Visual Regression Testing (VRT): Headless LibreOffice Calc pixel-by-pixel rendering checks.
194
254
  * Contract & Round-Trip Tests: Verifies parity between Streaming and In-Memory APIs and round-trip read/write accuracy.
195
- * Mutation Testing (Mutant): 100% mutant kill rate (1,528/1,528 mutations across 43 subjects) on pure algorithms, predicates, and coordinates ([docs/MUTATION_TESTING.md](docs/MUTATION_TESTING.md)).
255
+ * Mutation Testing (Mutant): 100% mutant kill rate (2,549/2,549 mutations across 51 subjects) on pure algorithms, predicates, and coordinates ([docs/MUTATION_TESTING.md](docs/MUTATION_TESTING.md)).
196
256
  * Security & DoS Protection: Formula injection mitigation and ZIP bomb protection.
197
257
 
198
258
  For full architectural details, see [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) and [docs/QUALITY_ASSURANCE.md](docs/QUALITY_ASSURANCE.md).
@@ -13,12 +13,12 @@ module RubyLsp
13
13
  STREAM_WRITER_ITEMS = [
14
14
  {
15
15
  label: "sheet",
16
- detail: "(name = nil, **opts) { |sheet| ... } -> void",
17
- documentation: "Adds a new worksheet to the streaming XLSX writer and yields a `WorksheetProxy`.\n\n```ruby\nwb.sheet(\"Sales\") do |s|\n s.row([\"Product\", \"Price\"], styles: :bold)\nend\n```"
16
+ detail: "(name = nil, state: nil, tab_color: nil, code_name: nil, **opts) { |sheet| ... } -> String",
17
+ documentation: "Adds a new worksheet to the streaming XLSX writer and yields a `WorksheetProxy`.\n\n```ruby\nwb.sheet(\"Sales\") do |s|\n s.row([\"Product\", \"Price\"], cell_styles: :bold)\nend\n```"
18
18
  },
19
19
  {
20
20
  label: "style",
21
- detail: "(name, **options) -> Symbol",
21
+ detail: "(name, **opts) { |style_builder| ... } -> StyleBuilder",
22
22
  documentation: "Registers a reusable named cell style (font, fill, border, alignment, number_format).\n\n```ruby\nwb.style(:bold_blue, font: { bold: true, color: \"0000FF\" })\n```"
23
23
  },
24
24
  {
@@ -27,7 +27,7 @@ module RubyLsp
27
27
  documentation: "Sets a workbook-level property (e.g. `:update_links`).\n\n```ruby\nwb.workbook_property(:update_links, \"never\")\n```"
28
28
  },
29
29
  {
30
- label: "protect_workbook",
30
+ label: "workbook_protection",
31
31
  detail: "(**opts) -> void",
32
32
  documentation: "Configures workbook protection options (e.g. `structure: true`, `windows: true`)."
33
33
  },
@@ -43,7 +43,7 @@ module RubyLsp
43
43
  },
44
44
  {
45
45
  label: "print_titles",
46
- detail: "(rows: nil, cols: nil, sheet: nil) -> void",
46
+ detail: "(rows: nil, columns: nil, sheet: nil) -> void",
47
47
  documentation: "Sets repeating title rows or columns for printing (e.g. `rows: \"1:2\"`)."
48
48
  },
49
49
  {
@@ -76,12 +76,12 @@ module RubyLsp
76
76
  WORKBOOK_BUILDER_ITEMS = [
77
77
  {
78
78
  label: "sheet",
79
- detail: "(name = nil, **opts) { |sheet_builder| ... } -> WorksheetBuilder",
79
+ detail: "(name = nil, state: nil, tab_color: nil, code_name: nil, **opts) { |sheet_builder| ... } -> Elements::Worksheet",
80
80
  documentation: "Adds a new worksheet to the workbook builder and yields a `WorksheetBuilder`.\n\n```ruby\nwb.sheet(\"Summary\") do |s|\n s.row([\"Item\", \"Total\"])\nend\n```"
81
81
  },
82
82
  {
83
83
  label: "style",
84
- detail: "(name, **opts) { |style_builder| ... } -> Symbol",
84
+ detail: "(name, **opts) { |style_builder| ... } -> StyleBuilder",
85
85
  documentation: "Defines a named style in the workbook builder."
86
86
  },
87
87
  {
@@ -95,7 +95,7 @@ module RubyLsp
95
95
  documentation: "Sets a workbook property."
96
96
  },
97
97
  {
98
- label: "protect_workbook",
98
+ label: "workbook_protection",
99
99
  detail: "(**opts) -> void",
100
100
  documentation: "Sets workbook protection options."
101
101
  },
@@ -111,7 +111,7 @@ module RubyLsp
111
111
  },
112
112
  {
113
113
  label: "print_titles",
114
- detail: "(rows: nil, cols: nil, sheet: nil) -> void",
114
+ detail: "(rows: nil, columns: nil, sheet: nil) -> void",
115
115
  documentation: "Sets repeating print titles."
116
116
  },
117
117
  {
@@ -139,8 +139,8 @@ module RubyLsp
139
139
  WORKSHEET_PROXY_ITEMS = [
140
140
  {
141
141
  label: "row",
142
- detail: "(values, styles: nil, height: nil, hidden: false, outline_level: nil) -> void",
143
- documentation: "Writes a single row of cells with optional style name, height, and outline level.\n\n```ruby\ns.row([\"Product\", \"Price\"], styles: :bold)\ns.row([\"Laptop\", 1200])\n```"
142
+ detail: "(values, cell_styles: nil, row_style: nil, height: nil, hidden: false, outline_level: nil) -> void",
143
+ documentation: "Writes a single row of cells with optional style name, height, and outline level.\n\n```ruby\ns.row([\"Product\", \"Price\"], cell_styles: :bold)\ns.row([\"Laptop\", 1200])\n```"
144
144
  },
145
145
  {
146
146
  label: "column",
@@ -149,13 +149,13 @@ module RubyLsp
149
149
  },
150
150
  {
151
151
  label: "merge",
152
- detail: "(range = nil, row: nil, col_start: nil, col_end: nil) -> void",
153
- documentation: "Merges a range of cells.\n\n```ruby\ns.merge(\"A1:C1\")\ns.merge(row: 0, col_start: 0, col_end: 2)\n```"
152
+ detail: "(range) -> void",
153
+ documentation: "Merges a range of cells.\n\n```ruby\ns.merge(\"A1:C1\")\n```"
154
154
  },
155
155
  {
156
156
  label: "freeze_pane",
157
- detail: "(row: 0, col: 0) -> void",
158
- documentation: "Freezes rows and columns from scrolling (0-based indices).\n\n```ruby\ns.freeze_pane(row: 1, col: 0) # Freeze top header row\n```"
157
+ detail: "(row: 0, column: 0) -> void",
158
+ documentation: "Freezes rows and columns from scrolling (0-based indices).\n\n```ruby\ns.freeze_pane(row: 1, column: 0) # Freeze top header row\n```"
159
159
  },
160
160
  {
161
161
  label: "auto_filter",
@@ -183,13 +183,13 @@ module RubyLsp
183
183
  documentation: "Adds conditional formatting rules (cellIs, colorScale, dataBar, expression)."
184
184
  },
185
185
  {
186
- label: "validate_data",
186
+ label: "data_validation",
187
187
  detail: "(range, type: \"list\", **opts) -> void",
188
188
  documentation: "Adds data validation rules (dropdown list, whole number, decimal, date range, custom formula)."
189
189
  },
190
190
  {
191
191
  label: "image",
192
- detail: "(file_data, ext: \"png\", from_col: 0, from_row: 0, to_col: 5, to_row: 10, **opts) -> void",
192
+ detail: "(file_data, ext: \"png\", from_column: 0, from_row: 0, to_column: 5, to_row: 10, **opts) -> void",
193
193
  documentation: "Inserts an image into the worksheet."
194
194
  },
195
195
  {
@@ -209,7 +209,7 @@ module RubyLsp
209
209
  },
210
210
  {
211
211
  label: "shape",
212
- detail: "(preset: \"rect\", text: nil, from_col: 0, from_row: 0, to_col: 5, to_row: 5, **opts) -> void",
212
+ detail: "(preset: \"rect\", text: nil, from_column: 0, from_row: 0, to_column: 5, to_row: 5, **opts) -> void",
213
213
  documentation: "Adds a drawing shape to the sheet."
214
214
  },
215
215
  {
@@ -233,7 +233,7 @@ module RubyLsp
233
233
  documentation: "Configures print options (e.g. `s.print_options(:grid_lines, true)`)."
234
234
  },
235
235
  {
236
- label: "protect_sheet",
236
+ label: "sheet_protection",
237
237
  detail: "(**opts) -> void",
238
238
  documentation: "Protects worksheet with optional password hashing and capability flags."
239
239
  },
@@ -248,7 +248,7 @@ module RubyLsp
248
248
  documentation: "Sets sheet properties (e.g. `s.sheet_properties(:tab_color, \"FF0000\")`)."
249
249
  },
250
250
  {
251
- label: "select_cell",
251
+ label: "selection",
252
252
  detail: "(active_cell, sqref: nil, pane: nil) -> void",
253
253
  documentation: "Sets the active / selected cell when opening the worksheet in Excel."
254
254
  },
@@ -268,12 +268,12 @@ module RubyLsp
268
268
  documentation: "Configures sort state conditions on a cell range."
269
269
  },
270
270
  {
271
- label: "page_break_row",
271
+ label: "row_break",
272
272
  detail: "(row_num) -> void",
273
273
  documentation: "Adds a horizontal page break before the given row index."
274
274
  },
275
275
  {
276
- label: "page_break_col",
276
+ label: "column_break",
277
277
  detail: "(col_index) -> void",
278
278
  documentation: "Adds a vertical page break before the given column index."
279
279
  }
@@ -283,7 +283,7 @@ module RubyLsp
283
283
  {
284
284
  label: "each_row",
285
285
  detail: "() { |row| ... } -> void",
286
- documentation: "Yields each row in the streaming sheet as an `Elements::Row`.\n\n```ruby\nsheet.each_row do |row|\n puts row.to_a.inspect\nend\n```"
286
+ documentation: "Yields each row in the streaming sheet as an `Elements::Row`.\n\n```ruby\nsheet.each_row do |row|\n puts row.values.inspect\nend\n```"
287
287
  },
288
288
  {
289
289
  label: "each",
@@ -308,11 +308,6 @@ module RubyLsp
308
308
  detail: "(index_or_name) -> Elements::Worksheet?",
309
309
  documentation: "Returns the worksheet by 0-based index or name.\n\n```ruby\nsheet = workbook[\"Sheet1\"]\n```"
310
310
  },
311
- {
312
- label: "update_sheet",
313
- detail: "(name_or_index, sheet) -> Elements::Workbook",
314
- documentation: "Replaces or updates a sheet and returns a new `Elements::Workbook`."
315
- },
316
311
  {
317
312
  label: "sheet_names",
318
313
  detail: "() -> Array<String>",
@@ -354,7 +349,7 @@ module RubyLsp
354
349
  {
355
350
  label: "each_row",
356
351
  detail: "() { |row| ... } -> void",
357
- documentation: "Yields each row in the worksheet as an `Elements::Row`.\n\n```ruby\nsheet.each_row do |row|\n puts row.to_a.inspect\nend\n```"
352
+ documentation: "Yields each row in the worksheet as an `Elements::Row`.\n\n```ruby\nsheet.each_row do |row|\n puts row.values.inspect\nend\n```"
358
353
  },
359
354
  {
360
355
  label: "each",
@@ -366,11 +361,6 @@ module RubyLsp
366
361
  detail: "() { |cell| ... } -> void",
367
362
  documentation: "Yields every `Elements::Cell` across all rows."
368
363
  },
369
- {
370
- label: "update_cell",
371
- detail: "(ref, new_value) -> Elements::Worksheet",
372
- documentation: "Returns a new worksheet with the updated cell value."
373
- },
374
364
  {
375
365
  label: "row_at",
376
366
  detail: "(row_index) -> Elements::Row?",
@@ -391,11 +381,6 @@ module RubyLsp
391
381
  detail: "() -> Array<Elements::Cell>",
392
382
  documentation: "Returns a flat array of all cells in the sheet."
393
383
  },
394
- {
395
- label: "cells_hash",
396
- detail: "() -> Hash<String, Elements::Cell>",
397
- documentation: "Returns a hash mapping A1 references to `Elements::Cell` objects."
398
- },
399
384
  {
400
385
  label: "name",
401
386
  detail: "() -> String",
@@ -416,13 +401,13 @@ module RubyLsp
416
401
  ROW_ELEMENT_ITEMS = [
417
402
  {
418
403
  label: "[]",
419
- detail: "(col_index_or_symbol) -> Elements::Cell? | Object?",
420
- documentation: "Returns the cell at 0-based column index, or access property symbol (`:cells`, `:index`, `:height`).\n\n```ruby\ncell = row[0]\n```"
404
+ detail: "(col_index_or_letter) -> Elements::Cell?",
405
+ documentation: "Returns the cell at 0-based column index or column letter/Symbol.\n\n```ruby\ncell = row[0]\n```"
421
406
  },
422
407
  {
423
408
  label: "to_a",
424
- detail: "() -> Array<Object?>",
425
- documentation: "Returns an array containing the values of all cells in this row.\n\n```ruby\nvalues = row.to_a\n```"
409
+ detail: "() -> Array<Elements::Cell>",
410
+ documentation: "Returns an array of all `Elements::Cell` objects in this row.\n\n```ruby\ncells = row.to_a\n```"
426
411
  },
427
412
  {
428
413
  label: "values",
@@ -507,11 +492,6 @@ module RubyLsp
507
492
  detail: "() -> Time?",
508
493
  documentation: "Converts cell value to Time."
509
494
  },
510
- {
511
- label: "column_letter",
512
- detail: "() -> String",
513
- documentation: "Returns the column letters (e.g. `\"A\"`, `\"AA\"`)."
514
- },
515
495
  {
516
496
  label: "row_index",
517
497
  detail: "() -> Integer",
@@ -527,16 +507,6 @@ module RubyLsp
527
507
  detail: "() -> Integer?",
528
508
  documentation: "Returns the 0-based index into stylesheet formatting."
529
509
  },
530
- {
531
- label: "content",
532
- detail: "() -> String",
533
- documentation: "Returns string content of cell value."
534
- },
535
- {
536
- label: "[]",
537
- detail: "(symbol) -> Object?",
538
- documentation: "Hash-style access to cell attributes (`:value`, `:ref`, `:style_index`)."
539
- },
540
510
  {
541
511
  label: "valid?",
542
512
  detail: "() -> Boolean",
@@ -605,12 +575,12 @@ module RubyLsp
605
575
  },
606
576
  {
607
577
  label: "border",
608
- detail: "(left: nil, right: nil, top: nil, bottom: nil) -> void",
578
+ detail: "(all: nil, left: nil, right: nil, top: nil, bottom: nil, diagonal: nil) -> self",
609
579
  documentation: "Sets cell border lines and colors."
610
580
  },
611
581
  {
612
582
  label: "alignment",
613
- detail: "(horizontal: nil, vertical: nil, wrap_text: false, rotation: 0) -> void",
583
+ detail: "(horizontal: nil, vertical: nil, wrap_text: nil, text_rotation: nil, indent: nil, shrink_to_fit: nil, ...) -> Hash | self",
614
584
  documentation: "Sets cell text alignment and text wrap."
615
585
  },
616
586
  {
@@ -696,7 +666,7 @@ module RubyLsp
696
666
  when :write then return :stream_writer
697
667
  when :read then return :stream_sheet
698
668
  when :build then return :workbook_builder
699
- when :modify then return :workbook
669
+ when :load then return :workbook
700
670
  end
701
671
  end
702
672