xlsxrb 0.1.17 → 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 (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +256 -1
  3. data/README.md +111 -28
  4. data/lib/ruby_lsp/xlsxrb/completion_listener.rb +439 -139
  5. data/lib/xlsxrb/chart_builder.rb +540 -193
  6. data/lib/xlsxrb/dsl_helpers.rb +178 -73
  7. data/lib/xlsxrb/elements/cell.rb +197 -130
  8. data/lib/xlsxrb/elements/column.rb +88 -7
  9. data/lib/xlsxrb/elements/coordinate_access.rb +86 -59
  10. data/lib/xlsxrb/elements/image.rb +18 -19
  11. data/lib/xlsxrb/elements/metadata.rb +2379 -0
  12. data/lib/xlsxrb/elements/row.rb +84 -118
  13. data/lib/xlsxrb/elements/styles.rb +140 -90
  14. data/lib/xlsxrb/elements/types.rb +164 -22
  15. data/lib/xlsxrb/elements/workbook.rb +122 -140
  16. data/lib/xlsxrb/elements/worksheet.rb +451 -226
  17. data/lib/xlsxrb/elements.rb +1 -0
  18. data/lib/xlsxrb/ooxml/reader/listeners/core_listeners.rb +16 -5
  19. data/lib/xlsxrb/ooxml/reader/listeners/drawing_listeners.rb +14 -9
  20. data/lib/xlsxrb/ooxml/reader/listeners/feature_listeners.rb +296 -34
  21. data/lib/xlsxrb/ooxml/reader/listeners/style_listeners.rb +17 -3
  22. data/lib/xlsxrb/ooxml/reader.rb +52 -50
  23. data/lib/xlsxrb/ooxml/styles_parser.rb +36 -5
  24. data/lib/xlsxrb/ooxml/utils.rb +2 -2
  25. data/lib/xlsxrb/ooxml/workbook_parser.rb +0 -1
  26. data/lib/xlsxrb/ooxml/workbook_writer.rb +242 -109
  27. data/lib/xlsxrb/ooxml/worksheet_parser.rb +63 -31
  28. data/lib/xlsxrb/ooxml/worksheet_writer.rb +119 -56
  29. data/lib/xlsxrb/ooxml/writer/drawing_xml.rb +33 -13
  30. data/lib/xlsxrb/ooxml/writer/features_xml.rb +75 -15
  31. data/lib/xlsxrb/ooxml/writer/styles_xml.rb +18 -8
  32. data/lib/xlsxrb/ooxml/writer.rb +124 -44
  33. data/lib/xlsxrb/ooxml/xml_parser.rb +78 -5
  34. data/lib/xlsxrb/ooxml/zip_generator.rb +2 -0
  35. data/lib/xlsxrb/ooxml/zip_reader.rb +112 -25
  36. data/lib/xlsxrb/ooxml/zip_writer.rb +119 -30
  37. data/lib/xlsxrb/stream_row.rb +56 -81
  38. data/lib/xlsxrb/stream_sheet.rb +542 -273
  39. data/lib/xlsxrb/stream_writer.rb +1536 -870
  40. data/lib/xlsxrb/style_builder.rb +667 -221
  41. data/lib/xlsxrb/version.rb +1 -1
  42. data/lib/xlsxrb/workbook_builder.rb +406 -143
  43. data/lib/xlsxrb/worksheet_builder.rb +1009 -900
  44. data/lib/xlsxrb.rb +1179 -1056
  45. data/sig/generated/xlsxrb/chart_builder.rbs +385 -159
  46. data/sig/generated/xlsxrb/dsl_helpers.rbs +81 -15
  47. data/sig/generated/xlsxrb/elements/cell.rbs +78 -70
  48. data/sig/generated/xlsxrb/elements/column.rbs +55 -3
  49. data/sig/generated/xlsxrb/elements/coordinate_access.rbs +35 -29
  50. data/sig/generated/xlsxrb/elements/image.rbs +7 -11
  51. data/sig/generated/xlsxrb/elements/metadata.rbs +1574 -0
  52. data/sig/generated/xlsxrb/elements/row.rbs +39 -42
  53. data/sig/generated/xlsxrb/elements/styles.rbs +66 -66
  54. data/sig/generated/xlsxrb/elements/types.rbs +27 -0
  55. data/sig/generated/xlsxrb/elements/workbook.rbs +46 -99
  56. data/sig/generated/xlsxrb/elements/worksheet.rbs +121 -96
  57. data/sig/generated/xlsxrb/ooxml/reader/listeners/feature_listeners.rbs +61 -4
  58. data/sig/generated/xlsxrb/ooxml/reader.rbs +2 -2
  59. data/sig/generated/xlsxrb/ooxml/styles_parser.rbs +1 -1
  60. data/sig/generated/xlsxrb/ooxml/utils.rbs +3 -3
  61. data/sig/generated/xlsxrb/ooxml/workbook_writer.rbs +13 -1
  62. data/sig/generated/xlsxrb/ooxml/worksheet_parser.rbs +16 -0
  63. data/sig/generated/xlsxrb/ooxml/worksheet_writer.rbs +6 -4
  64. data/sig/generated/xlsxrb/ooxml/writer/features_xml.rbs +7 -0
  65. data/sig/generated/xlsxrb/ooxml/writer.rbs +22 -13
  66. data/sig/generated/xlsxrb/ooxml/xml_parser.rbs +70 -0
  67. data/sig/generated/xlsxrb/ooxml/zip_generator.rbs +2 -0
  68. data/sig/generated/xlsxrb/ooxml/zip_reader.rbs +24 -9
  69. data/sig/generated/xlsxrb/ooxml/zip_writer.rbs +26 -1
  70. data/sig/generated/xlsxrb/stream_row.rbs +32 -33
  71. data/sig/generated/xlsxrb/stream_sheet.rbs +233 -181
  72. data/sig/generated/xlsxrb/stream_writer.rbs +961 -667
  73. data/sig/generated/xlsxrb/style_builder.rbs +402 -128
  74. data/sig/generated/xlsxrb/workbook_builder.rbs +223 -71
  75. data/sig/generated/xlsxrb/worksheet_builder.rbs +579 -453
  76. data/sig/generated/xlsxrb.rbs +205 -144
  77. data/sig/rexml.rbs +8 -0
  78. metadata +5 -5
  79. data/lib/xlsxrb/utils.rb +0 -291
  80. data/sig/generated/xlsxrb/utils.rbs +0 -184
@@ -13,21 +13,21 @@ 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
  {
25
- label: "workbook_property",
26
- detail: "(name, value) -> void",
27
- documentation: "Sets a workbook-level property (e.g. `:update_links`).\n\n```ruby\nwb.workbook_property(:update_links, \"never\")\n```"
25
+ label: "workbook_properties",
26
+ detail: "(**opts) -> Elements::WorkbookProperties | void",
27
+ documentation: "Configures or queries workbook-level properties (e.g. `:update_links`).\n\n```ruby\nwb.workbook_properties(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
  {
@@ -52,14 +52,14 @@ module RubyLsp
52
52
  documentation: "Sets multiple core and application metadata properties at once."
53
53
  },
54
54
  {
55
- label: "core_property",
56
- detail: "(name, value) -> void",
57
- documentation: "Sets core document metadata (e.g. `:title`, `:creator`, `:subject`, `:keywords`)."
55
+ label: "core_properties",
56
+ detail: "(**opts) -> Elements::CoreProperties | void",
57
+ documentation: "Configures or queries core document metadata (e.g. `:title`, `:creator`, `:subject`, `:keywords`)."
58
58
  },
59
59
  {
60
- label: "app_property",
61
- detail: "(name, value) -> void",
62
- documentation: "Sets application document metadata (e.g. `:company`, `:manager`)."
60
+ label: "app_properties",
61
+ detail: "(**opts) -> Elements::AppProperties | void",
62
+ documentation: "Configures or queries application document metadata (e.g. `:company`, `:manager`)."
63
63
  },
64
64
  {
65
65
  label: "custom_property",
@@ -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
  {
@@ -90,12 +90,12 @@ module RubyLsp
90
90
  documentation: "Builds and returns the immutable `Elements::Workbook` DOM hierarchy."
91
91
  },
92
92
  {
93
- label: "workbook_property",
94
- detail: "(name, value) -> void",
95
- documentation: "Sets a workbook property."
93
+ label: "workbook_properties",
94
+ detail: "(**opts) -> Elements::WorkbookProperties | void",
95
+ documentation: "Configures or queries workbook properties."
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
  {
@@ -120,14 +120,14 @@ module RubyLsp
120
120
  documentation: "Sets multiple metadata properties."
121
121
  },
122
122
  {
123
- label: "core_property",
124
- detail: "(name, value) -> void",
125
- documentation: "Sets core document metadata."
123
+ label: "core_properties",
124
+ detail: "(**opts) -> Elements::CoreProperties | void",
125
+ documentation: "Configures or queries core document metadata."
126
126
  },
127
127
  {
128
- label: "app_property",
129
- detail: "(name, value) -> void",
130
- documentation: "Sets application document metadata."
128
+ label: "app_properties",
129
+ detail: "(**opts) -> Elements::AppProperties | void",
130
+ documentation: "Configures or queries application document metadata."
131
131
  },
132
132
  {
133
133
  label: "custom_property",
@@ -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,18 +183,18 @@ 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
  {
196
196
  label: "comment",
197
- detail: "(cell, text, author: nil) -> void",
197
+ detail: "(cell, text, author: nil, visible: false) -> void",
198
198
  documentation: "Adds an author comment / note to a cell."
199
199
  },
200
200
  {
@@ -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
  {
@@ -229,26 +229,26 @@ module RubyLsp
229
229
  },
230
230
  {
231
231
  label: "print_options",
232
- detail: "(name, value) -> void",
233
- documentation: "Configures print options (e.g. `s.print_options(:grid_lines, true)`)."
232
+ detail: "(**opts) -> void",
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
  },
240
240
  {
241
241
  label: "sheet_view",
242
- detail: "(name, value) -> void",
243
- documentation: "Sets view settings (e.g. `s.sheet_view(:show_grid_lines, false)`)."
242
+ detail: "(**opts) -> void",
243
+ documentation: "Sets view settings (e.g. `s.sheet_view(show_grid_lines: false)`)."
244
244
  },
245
245
  {
246
246
  label: "sheet_properties",
247
- detail: "(name, value) -> void",
248
- documentation: "Sets sheet properties (e.g. `s.sheet_properties(:tab_color, \"FF0000\")`)."
247
+ detail: "(**opts) -> void",
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>",
@@ -332,11 +327,6 @@ module RubyLsp
332
327
  label: "valid?",
333
328
  detail: "() -> Boolean",
334
329
  documentation: "Returns true if all workbook elements and sheets are valid."
335
- },
336
- {
337
- label: "validate",
338
- detail: "() -> Array<String>",
339
- documentation: "Validates workbook structure and returns any validation errors."
340
330
  }
341
331
  ].freeze
342
332
 
@@ -346,15 +336,10 @@ module RubyLsp
346
336
  detail: "(cell_ref) -> Elements::Cell?",
347
337
  documentation: "Finds and returns a cell by A1 reference.\n\n```ruby\ncell = sheet[\"B2\"]\n```"
348
338
  },
349
- {
350
- label: "cell_value",
351
- detail: "(cell_ref) -> Object?",
352
- documentation: "Returns the raw value of the cell at the given A1 reference."
353
- },
354
339
  {
355
340
  label: "each_row",
356
341
  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```"
342
+ 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
343
  },
359
344
  {
360
345
  label: "each",
@@ -366,11 +351,6 @@ module RubyLsp
366
351
  detail: "() { |cell| ... } -> void",
367
352
  documentation: "Yields every `Elements::Cell` across all rows."
368
353
  },
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
354
  {
375
355
  label: "row_at",
376
356
  detail: "(row_index) -> Elements::Row?",
@@ -391,11 +371,6 @@ module RubyLsp
391
371
  detail: "() -> Array<Elements::Cell>",
392
372
  documentation: "Returns a flat array of all cells in the sheet."
393
373
  },
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
374
  {
400
375
  label: "name",
401
376
  detail: "() -> String",
@@ -405,24 +380,19 @@ module RubyLsp
405
380
  label: "valid?",
406
381
  detail: "() -> Boolean",
407
382
  documentation: "Returns true if all cells and rows in the worksheet are valid."
408
- },
409
- {
410
- label: "validate",
411
- detail: "() -> Array<String>",
412
- documentation: "Returns any validation errors found in the worksheet."
413
383
  }
414
384
  ].freeze
415
385
 
416
386
  ROW_ELEMENT_ITEMS = [
417
387
  {
418
388
  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```"
389
+ detail: "(col_index_or_letter) -> Elements::Cell?",
390
+ documentation: "Returns the cell at 0-based column index or column letter/Symbol.\n\n```ruby\ncell = row[0]\n```"
421
391
  },
422
392
  {
423
393
  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```"
394
+ detail: "() -> Array<Elements::Cell>",
395
+ documentation: "Returns an array of all `Elements::Cell` objects in this row.\n\n```ruby\ncells = row.to_a\n```"
426
396
  },
427
397
  {
428
398
  label: "values",
@@ -463,11 +433,6 @@ module RubyLsp
463
433
  label: "valid?",
464
434
  detail: "() -> Boolean",
465
435
  documentation: "Returns true if all cells in this row are valid."
466
- },
467
- {
468
- label: "validate",
469
- detail: "() -> Array<String>",
470
- documentation: "Validates all cells in this row and returns error messages."
471
436
  }
472
437
  ].freeze
473
438
 
@@ -507,11 +472,6 @@ module RubyLsp
507
472
  detail: "() -> Time?",
508
473
  documentation: "Converts cell value to Time."
509
474
  },
510
- {
511
- label: "column_letter",
512
- detail: "() -> String",
513
- documentation: "Returns the column letters (e.g. `\"A\"`, `\"AA\"`)."
514
- },
515
475
  {
516
476
  label: "row_index",
517
477
  detail: "() -> Integer",
@@ -527,96 +487,436 @@ module RubyLsp
527
487
  detail: "() -> Integer?",
528
488
  documentation: "Returns the 0-based index into stylesheet formatting."
529
489
  },
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
490
  {
541
491
  label: "valid?",
542
492
  detail: "() -> Boolean",
543
493
  documentation: "Returns true if row_index, column_index, and value are valid."
544
- },
545
- {
546
- label: "validate",
547
- detail: "() -> Array<String>",
548
- documentation: "Returns validation errors if indices are negative or invalid."
549
494
  }
550
495
  ].freeze
551
496
 
552
497
  CHART_BUILDER_ITEMS = [
498
+ {
499
+ label: "type",
500
+ detail: "() -> Symbol | String | nil",
501
+ documentation: "Gets chart type (e.g. :line, :bar, :pie, :radar, :scatter)."
502
+ },
503
+ {
504
+ label: "type=",
505
+ detail: "(value) -> Symbol | String | nil",
506
+ documentation: "Sets chart type (e.g. :line, :bar, :pie, :radar, :scatter)."
507
+ },
553
508
  {
554
509
  label: "title",
555
- detail: "(text) -> void",
556
- documentation: "Sets the chart title text."
510
+ detail: "(**kwargs) -> String | Hash | nil",
511
+ documentation: "Gets or configures chart title text or options."
512
+ },
513
+ {
514
+ label: "title=",
515
+ detail: "(value) -> String | Hash | nil",
516
+ documentation: "Sets chart title text or options hash."
557
517
  },
558
518
  {
559
519
  label: "series",
560
- detail: "(range, name: nil) -> void",
561
- documentation: "Adds data series value range."
520
+ detail: "(**kwargs) { |series_builder| ... } -> Array<Hash> | nil",
521
+ documentation: "Adds data series value range or yields a SeriesBuilder."
562
522
  },
563
523
  {
564
- label: "categories",
565
- detail: "(range) -> void",
566
- documentation: "Sets category label range (e.g. `'Sheet1!$A$2:$A$10'`)."
524
+ label: "series=",
525
+ detail: "(value) -> Array<Hash> | Hash",
526
+ documentation: "Sets series array or configuration hash."
567
527
  },
568
528
  {
569
529
  label: "legend",
570
- detail: "(position: 'r') -> void",
571
- documentation: "Configures legend position (`'r'`, `'l'`, `'t'`, `'b'`, `'none'`)."
530
+ detail: "(**kwargs) -> Object?",
531
+ documentation: "Gets or configures chart legend properties."
532
+ },
533
+ {
534
+ label: "legend=",
535
+ detail: "(value) -> Object?",
536
+ documentation: "Sets chart legend properties."
537
+ },
538
+ {
539
+ label: "plot_area",
540
+ detail: "(**kwargs) -> Object?",
541
+ documentation: "Gets or configures plot area properties."
572
542
  },
573
543
  {
574
- label: "plot_by",
575
- detail: "(grouping) -> void",
576
- documentation: "Sets series grouping (`'standard'`, `'stacked'`, `'percentStacked'`)."
544
+ label: "plot_area=",
545
+ detail: "(value) -> Object?",
546
+ documentation: "Sets plot area properties."
577
547
  },
578
548
  {
579
- label: "dimension",
580
- detail: "(from_col: 0, from_row: 0, to_col: 8, to_row: 15) -> void",
581
- documentation: "Sets chart position and size on the worksheet."
549
+ label: "chart_space",
550
+ detail: "(**kwargs) -> Object?",
551
+ documentation: "Gets or configures chart space properties."
582
552
  },
583
553
  {
584
- label: "gridlines",
585
- detail: "(horizontal: true, vertical: false) -> void",
586
- documentation: "Configures chart major gridlines."
554
+ label: "chart_space=",
555
+ detail: "(value) -> Object?",
556
+ documentation: "Sets chart space properties."
587
557
  },
588
558
  {
589
559
  label: "style",
590
- detail: "(id) -> void",
560
+ detail: "() -> Object?",
561
+ documentation: "Gets built-in chart style number (1-48) or options."
562
+ },
563
+ {
564
+ label: "style=",
565
+ detail: "(value) -> Object?",
591
566
  documentation: "Sets built-in chart style number (1-48)."
567
+ },
568
+ {
569
+ label: "data_labels",
570
+ detail: "(**kwargs) -> Object?",
571
+ documentation: "Gets or configures chart data labels."
572
+ },
573
+ {
574
+ label: "data_labels=",
575
+ detail: "(value) -> Object?",
576
+ documentation: "Sets chart data labels."
577
+ },
578
+ {
579
+ label: "plot_visible_only?",
580
+ detail: "() -> bool",
581
+ documentation: "Returns whether to plot visible cells only."
582
+ },
583
+ {
584
+ label: "plot_visible_only=",
585
+ detail: "(value) -> bool?",
586
+ documentation: "Sets whether to plot visible cells only."
587
+ },
588
+ {
589
+ label: "display_blanks_as",
590
+ detail: "() -> String?",
591
+ documentation: "Gets how blank cells are displayed in the chart."
592
+ },
593
+ {
594
+ label: "display_blanks_as=",
595
+ detail: "(value) -> String?",
596
+ documentation: "Sets how blank cells are displayed in the chart."
597
+ },
598
+ {
599
+ label: "view3d",
600
+ detail: "(**kwargs) -> Object?",
601
+ documentation: "Gets or configures 3D view properties."
602
+ },
603
+ {
604
+ label: "view3d=",
605
+ detail: "(value) -> Object?",
606
+ documentation: "Sets 3D view properties."
607
+ },
608
+ {
609
+ label: "category_axis",
610
+ detail: "(**kwargs) -> Object?",
611
+ documentation: "Gets or configures category axis properties."
612
+ },
613
+ {
614
+ label: "category_axis=",
615
+ detail: "(value) -> Object?",
616
+ documentation: "Sets category axis properties."
617
+ },
618
+ {
619
+ label: "value_axis",
620
+ detail: "(**kwargs) -> Object?",
621
+ documentation: "Gets or configures value axis properties."
622
+ },
623
+ {
624
+ label: "value_axis=",
625
+ detail: "(value) -> Object?",
626
+ documentation: "Sets value axis properties."
627
+ },
628
+ {
629
+ label: "secondary_value_axis",
630
+ detail: "(**kwargs) -> Object?",
631
+ documentation: "Gets or configures secondary value axis properties."
632
+ },
633
+ {
634
+ label: "secondary_value_axis=",
635
+ detail: "(value) -> Object?",
636
+ documentation: "Sets secondary value axis properties."
637
+ },
638
+ {
639
+ label: "show_legend_key?",
640
+ detail: "() -> bool",
641
+ documentation: "Returns whether to show the legend key in data labels."
642
+ },
643
+ {
644
+ label: "show_legend_key=",
645
+ detail: "(value) -> bool?",
646
+ documentation: "Sets whether to show the legend key in data labels."
592
647
  }
593
648
  ].freeze
594
649
 
595
650
  STYLE_BUILDER_ITEMS = [
651
+ {
652
+ label: "bold=",
653
+ detail: "(bool) -> bool",
654
+ documentation: "Sets whether font is bold."
655
+ },
656
+ {
657
+ label: "bold?",
658
+ detail: "() -> Boolean",
659
+ documentation: "Returns whether font is bold."
660
+ },
661
+ {
662
+ label: "italic=",
663
+ detail: "(bool) -> bool",
664
+ documentation: "Sets whether font is italic."
665
+ },
666
+ {
667
+ label: "italic?",
668
+ detail: "() -> Boolean",
669
+ documentation: "Returns whether font is italic."
670
+ },
671
+ {
672
+ label: "font_size=",
673
+ detail: "(Numeric) -> Numeric",
674
+ documentation: "Sets font size in points."
675
+ },
676
+ {
677
+ label: "font_size",
678
+ detail: "() -> Numeric?",
679
+ documentation: "Returns font size in points."
680
+ },
681
+ {
682
+ label: "font_name=",
683
+ detail: "(String) -> String",
684
+ documentation: "Sets font family name."
685
+ },
686
+ {
687
+ label: "font_name",
688
+ detail: "() -> String?",
689
+ documentation: "Returns font family name."
690
+ },
691
+ {
692
+ label: "font_color=",
693
+ detail: "(color) -> Object",
694
+ documentation: "Sets font text color."
695
+ },
696
+ {
697
+ label: "font_color",
698
+ detail: "() -> String?",
699
+ documentation: "Returns font text color."
700
+ },
701
+ {
702
+ label: "underline=",
703
+ detail: "(val) -> Object",
704
+ documentation: "Sets font underline style."
705
+ },
706
+ {
707
+ label: "underline",
708
+ detail: "() -> Object?",
709
+ documentation: "Returns font underline style."
710
+ },
711
+ {
712
+ label: "underline?",
713
+ detail: "() -> Boolean",
714
+ documentation: "Returns whether font underline is enabled."
715
+ },
716
+ {
717
+ label: "strike=",
718
+ detail: "(bool) -> bool",
719
+ documentation: "Sets whether font has strikethrough."
720
+ },
721
+ {
722
+ label: "strike?",
723
+ detail: "() -> Boolean",
724
+ documentation: "Returns whether font has strikethrough."
725
+ },
726
+ {
727
+ label: "vert_align=",
728
+ detail: "(val) -> Object",
729
+ documentation: "Sets font vertical alignment (superscript/subscript)."
730
+ },
731
+ {
732
+ label: "vert_align",
733
+ detail: "() -> String?",
734
+ documentation: "Returns font vertical alignment."
735
+ },
736
+ {
737
+ label: "superscript=",
738
+ detail: "(bool) -> Object",
739
+ documentation: "Sets font superscript."
740
+ },
741
+ {
742
+ label: "superscript?",
743
+ detail: "() -> Boolean",
744
+ documentation: "Returns whether font superscript is enabled."
745
+ },
746
+ {
747
+ label: "subscript=",
748
+ detail: "(bool) -> Object",
749
+ documentation: "Sets font subscript."
750
+ },
751
+ {
752
+ label: "subscript?",
753
+ detail: "() -> Boolean",
754
+ documentation: "Returns whether font subscript is enabled."
755
+ },
756
+ {
757
+ label: "fill_color=",
758
+ detail: "(color) -> Object",
759
+ documentation: "Sets solid background fill color."
760
+ },
761
+ {
762
+ label: "fill_color",
763
+ detail: "() -> String?",
764
+ documentation: "Returns background fill color."
765
+ },
766
+ {
767
+ label: "fill_pattern",
768
+ detail: "(?pattern, ?fg_color: nil, ?bg_color: nil) -> Object?",
769
+ documentation: "Gets or sets background fill pattern and colors."
770
+ },
771
+ {
772
+ label: "fill_gradient",
773
+ detail: "(?type: nil, ?degree: nil, ?stops: []) -> Hash?",
774
+ documentation: "Gets or sets gradient fill."
775
+ },
776
+ {
777
+ label: "align_horizontal=",
778
+ detail: "(val) -> Object",
779
+ documentation: "Sets horizontal text alignment."
780
+ },
781
+ {
782
+ label: "align_horizontal",
783
+ detail: "() -> Object?",
784
+ documentation: "Returns horizontal text alignment."
785
+ },
786
+ {
787
+ label: "align_vertical=",
788
+ detail: "(val) -> Object",
789
+ documentation: "Sets vertical text alignment."
790
+ },
791
+ {
792
+ label: "align_vertical",
793
+ detail: "() -> Object?",
794
+ documentation: "Returns vertical text alignment."
795
+ },
796
+ {
797
+ label: "wrap_text=",
798
+ detail: "(bool) -> bool",
799
+ documentation: "Sets text wrapping."
800
+ },
801
+ {
802
+ label: "wrap_text?",
803
+ detail: "() -> Boolean",
804
+ documentation: "Returns whether text wrapping is enabled."
805
+ },
806
+ {
807
+ label: "shrink_to_fit=",
808
+ detail: "(bool) -> bool",
809
+ documentation: "Sets shrink to fit."
810
+ },
811
+ {
812
+ label: "shrink_to_fit?",
813
+ detail: "() -> Boolean",
814
+ documentation: "Returns whether shrink to fit is enabled."
815
+ },
816
+ {
817
+ label: "text_rotation=",
818
+ detail: "(Numeric) -> Numeric",
819
+ documentation: "Sets text rotation in degrees."
820
+ },
821
+ {
822
+ label: "text_rotation",
823
+ detail: "() -> Numeric?",
824
+ documentation: "Returns text rotation in degrees."
825
+ },
826
+ {
827
+ label: "indent=",
828
+ detail: "(Numeric) -> Numeric",
829
+ documentation: "Sets text indentation level."
830
+ },
831
+ {
832
+ label: "indent",
833
+ detail: "() -> Integer?",
834
+ documentation: "Returns text indentation level."
835
+ },
836
+ {
837
+ label: "locked=",
838
+ detail: "(bool) -> bool",
839
+ documentation: "Sets whether cell is locked."
840
+ },
841
+ {
842
+ label: "locked?",
843
+ detail: "() -> Boolean",
844
+ documentation: "Returns whether cell is locked."
845
+ },
846
+ {
847
+ label: "hidden=",
848
+ detail: "(bool) -> bool",
849
+ documentation: "Sets whether cell formula is hidden."
850
+ },
851
+ {
852
+ label: "hidden?",
853
+ detail: "() -> Boolean",
854
+ documentation: "Returns whether cell formula is hidden."
855
+ },
856
+ {
857
+ label: "number_format=",
858
+ detail: "(code_or_id) -> Object",
859
+ documentation: "Sets custom number format code or built-in ID."
860
+ },
861
+ {
862
+ label: "number_format",
863
+ detail: "() -> Object?",
864
+ documentation: "Returns custom number format code or built-in ID."
865
+ },
866
+ {
867
+ label: "border_all",
868
+ detail: "(style: 'thin', color: nil) -> void",
869
+ documentation: "Sets all borders to the given style and color."
870
+ },
871
+ {
872
+ label: "border_top",
873
+ detail: "(style: 'thin', color: nil) -> void",
874
+ documentation: "Sets top border style and color."
875
+ },
876
+ {
877
+ label: "border_bottom",
878
+ detail: "(style: 'thin', color: nil) -> void",
879
+ documentation: "Sets bottom border style and color."
880
+ },
881
+ {
882
+ label: "border_left",
883
+ detail: "(style: 'thin', color: nil) -> void",
884
+ documentation: "Sets left border style and color."
885
+ },
886
+ {
887
+ label: "border_right",
888
+ detail: "(style: 'thin', color: nil) -> void",
889
+ documentation: "Sets right border style and color."
890
+ },
891
+ {
892
+ label: "border_diagonal",
893
+ detail: "(style: 'thin', color: nil, up: false, down: false) -> void",
894
+ documentation: "Sets diagonal border style and color."
895
+ },
596
896
  {
597
897
  label: "font",
598
- detail: "(name: 'Calibri', size: 11, bold: false, italic: false, underline: false, color: nil) -> void",
599
- documentation: "Sets font typography, size, weight, and color."
898
+ detail: "(**opts) -> Hash | void",
899
+ documentation: "Configures font typography, size, weight, and color, or returns font properties."
600
900
  },
601
901
  {
602
902
  label: "fill",
603
- detail: "(pattern: 'solid', fg_color: nil, bg_color: nil) -> void",
604
- documentation: "Sets background fill pattern and foreground color."
903
+ detail: "(**opts) -> Hash | void",
904
+ documentation: "Configures background fill pattern and foreground color, or returns fill properties."
605
905
  },
606
906
  {
607
907
  label: "border",
608
- detail: "(left: nil, right: nil, top: nil, bottom: nil) -> void",
609
- documentation: "Sets cell border lines and colors."
908
+ detail: "(**opts) -> Hash | void",
909
+ documentation: "Configures cell border lines and colors, or returns border properties."
610
910
  },
611
911
  {
612
912
  label: "alignment",
613
- detail: "(horizontal: nil, vertical: nil, wrap_text: false, rotation: 0) -> void",
614
- documentation: "Sets cell text alignment and text wrap."
913
+ detail: "(**opts) -> Hash | void",
914
+ documentation: "Configures cell text alignment and text wrap, or returns alignment properties."
615
915
  },
616
916
  {
617
- label: "number_format",
618
- detail: "(format_code_or_id) -> void",
619
- documentation: "Sets custom number or date format code (e.g. `'#,##0.00'`, `'yyyy-mm-dd'`)."
917
+ label: "protection",
918
+ detail: "(**opts) -> Hash | void",
919
+ documentation: "Configures cell protection (locked, hidden), or returns protection properties."
620
920
  }
621
921
  ].freeze
622
922
 
@@ -696,7 +996,7 @@ module RubyLsp
696
996
  when :write then return :stream_writer
697
997
  when :read then return :stream_sheet
698
998
  when :build then return :workbook_builder
699
- when :modify then return :workbook
999
+ when :load then return :workbook
700
1000
  end
701
1001
  end
702
1002