xlsxrb 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +27 -12
- data/Steepfile +1 -0
- data/docs/visual/VisualGallery.md +8 -0
- data/docs/wasm/ruby.wasm +0 -0
- data/lib/ruby_lsp/xlsxrb/addon.rb +43 -0
- data/lib/ruby_lsp/xlsxrb/completion_listener.rb +769 -0
- data/lib/xlsxrb/elements/cell.rb +98 -4
- data/lib/xlsxrb/elements/column.rb +22 -0
- data/lib/xlsxrb/elements/row.rb +81 -1
- data/lib/xlsxrb/elements/types.rb +36 -5
- data/lib/xlsxrb/elements/workbook.rb +73 -5
- data/lib/xlsxrb/elements/worksheet.rb +110 -1
- data/lib/xlsxrb/version.rb +1 -1
- data/lib/xlsxrb.rb +530 -181
- data/sig/generated/xlsxrb/elements/cell.rbs +10 -1
- data/sig/generated/xlsxrb/elements/column.rbs +5 -0
- data/sig/generated/xlsxrb/elements/row.rbs +8 -1
- data/sig/generated/xlsxrb/elements/types.rbs +13 -5
- data/sig/generated/xlsxrb/elements/workbook.rbs +8 -1
- data/sig/generated/xlsxrb/elements/worksheet.rbs +7 -0
- data/sig/generated/xlsxrb.rbs +606 -236
- metadata +3 -1
data/sig/generated/xlsxrb.rbs
CHANGED
|
@@ -253,22 +253,39 @@ module Xlsxrb
|
|
|
253
253
|
|
|
254
254
|
# Creates a Formula object for use in row values.
|
|
255
255
|
#
|
|
256
|
-
# @
|
|
256
|
+
# @example Create a basic sum formula
|
|
257
|
+
# formula = Xlsxrb.formula("SUM(A1:A10)")
|
|
258
|
+
#
|
|
259
|
+
# @example Create a formula with precomputed cached value
|
|
260
|
+
# formula = Xlsxrb.formula("A1+B1", cached_value: 42)
|
|
261
|
+
#
|
|
262
|
+
# @param expression [String] The formula text without '=' (e.g. "SUM(A1:A10)").
|
|
257
263
|
# @param cached_value [Object, nil] Optional cached result. If nil, Excel will calculate on open.
|
|
258
264
|
# @return [Elements::Formula]
|
|
259
265
|
# @api public
|
|
260
|
-
# : (String expression, ?cached_value: String | Numeric | bool | nil) ->
|
|
261
|
-
def self.formula: (String expression, ?cached_value: String | Numeric | bool | nil) ->
|
|
266
|
+
# : (String expression, ?cached_value: String | Numeric | bool | nil) -> Elements::Formula
|
|
267
|
+
def self.formula: (String expression, ?cached_value: String | Numeric | bool | nil) -> Elements::Formula
|
|
262
268
|
|
|
263
|
-
# Reads an XLSX file into an Elements::Workbook.
|
|
269
|
+
# Reads an XLSX file into an in-memory Elements::Workbook.
|
|
270
|
+
#
|
|
271
|
+
# @example Read from file path
|
|
272
|
+
# workbook = Xlsxrb.read("data.xlsx")
|
|
273
|
+
# sheet = workbook["Sheet1"]
|
|
274
|
+
# puts sheet["A1"].value
|
|
275
|
+
#
|
|
276
|
+
# @example Read from IO stream
|
|
277
|
+
# workbook = File.open("data.xlsx", "rb") { |io| Xlsxrb.read(io) }
|
|
264
278
|
#
|
|
265
279
|
# @param source [String, IO] File path or IO object.
|
|
266
280
|
# @return [Elements::Workbook] The parsed workbook.
|
|
267
281
|
# @api public
|
|
268
|
-
# : (untyped source) ->
|
|
269
|
-
def self.read: (untyped source) ->
|
|
282
|
+
# : (untyped source) -> Elements::Workbook
|
|
283
|
+
def self.read: (untyped source) -> Elements::Workbook
|
|
270
284
|
|
|
271
|
-
# Writes an Elements::Workbook to an XLSX file.
|
|
285
|
+
# Writes an Elements::Workbook to an XLSX file or IO stream.
|
|
286
|
+
#
|
|
287
|
+
# @example Write to file
|
|
288
|
+
# Xlsxrb.write("output.xlsx", workbook)
|
|
272
289
|
#
|
|
273
290
|
# @param target [String, IO] File path or IO object.
|
|
274
291
|
# @param workbook [Elements::Workbook] The workbook to write.
|
|
@@ -282,10 +299,10 @@ module Xlsxrb
|
|
|
282
299
|
# The block receives an Elements::Workbook and must return a modified one (e.g. via `update_sheet`).
|
|
283
300
|
# If no target is given, the source is overwritten.
|
|
284
301
|
#
|
|
285
|
-
# @example
|
|
286
|
-
# Xlsxrb.modify("template.xlsx", "output.xlsx") do |
|
|
287
|
-
#
|
|
288
|
-
# sheet.update_cell("B1", value: "Updated")
|
|
302
|
+
# @example Modify a template and save to new file
|
|
303
|
+
# Xlsxrb.modify("template.xlsx", "output.xlsx") do |workbook|
|
|
304
|
+
# workbook.update_sheet("Sheet1") do |sheet|
|
|
305
|
+
# sheet.update_cell("B1", value: "Updated Title")
|
|
289
306
|
# .update_cell("B2", value: 100)
|
|
290
307
|
# end
|
|
291
308
|
# end
|
|
@@ -297,53 +314,103 @@ module Xlsxrb
|
|
|
297
314
|
# @yieldreturn [Elements::Workbook] The modified workbook.
|
|
298
315
|
# @return [void]
|
|
299
316
|
# @api public
|
|
300
|
-
# : (untyped source, ?untyped target) ?{ (
|
|
301
|
-
def self.modify: (untyped source, ?untyped target) ?{ (
|
|
317
|
+
# : (untyped source, ?untyped target) ?{ (Elements::Workbook) -> untyped } -> void
|
|
318
|
+
def self.modify: (untyped source, ?untyped target) ?{ (Elements::Workbook) -> untyped } -> void
|
|
302
319
|
|
|
303
|
-
# Represents a sheet being streamed sequentially.
|
|
320
|
+
# Represents a sheet being streamed sequentially from an XLSX file.
|
|
321
|
+
#
|
|
322
|
+
# @example Iterate rows in streaming mode
|
|
323
|
+
# Xlsxrb.foreach("large_data.xlsx") do |sheet|
|
|
324
|
+
# puts "Processing sheet: #{sheet.name}"
|
|
325
|
+
# sheet.each_row do |row|
|
|
326
|
+
# puts row.to_a.inspect
|
|
327
|
+
# end
|
|
328
|
+
# end
|
|
329
|
+
#
|
|
330
|
+
# @api public
|
|
304
331
|
class StreamSheet
|
|
305
332
|
attr_reader name: untyped
|
|
306
333
|
|
|
307
|
-
|
|
334
|
+
# @param name [String] The sheet name.
|
|
335
|
+
# @param sheet_xml [String] Raw XML content of the sheet.
|
|
336
|
+
# @param shared_strings [Array<String>] Shared strings table.
|
|
337
|
+
# : (String name, String sheet_xml, Array[String] shared_strings) -> void
|
|
338
|
+
def initialize: (String name, String sheet_xml, Array[String] shared_strings) -> void
|
|
308
339
|
|
|
340
|
+
# Iterate over rows in this streaming sheet.
|
|
341
|
+
#
|
|
342
|
+
# @yield [row]
|
|
343
|
+
# @yieldparam row [Elements::Row]
|
|
344
|
+
# @return [Enumerator, void]
|
|
345
|
+
# @api public
|
|
309
346
|
# : () { (Elements::Row) -> void } -> void
|
|
310
347
|
# : | () -> Enumerator[Elements::Row, void]
|
|
311
348
|
def each_row: () { (Elements::Row) -> void } -> void
|
|
312
349
|
|
|
350
|
+
# Iterate over rows in this streaming sheet.
|
|
351
|
+
#
|
|
352
|
+
# @yield [row]
|
|
353
|
+
# @yieldparam row [Elements::Row]
|
|
354
|
+
# @return [Enumerator, void]
|
|
355
|
+
# @api public
|
|
313
356
|
# : () { (Elements::Row) -> void } -> void
|
|
314
357
|
# : | () -> Enumerator[Elements::Row, void]
|
|
315
358
|
def each: () { (Elements::Row) -> void } -> void
|
|
316
359
|
end
|
|
317
360
|
|
|
318
|
-
# Streaming read: yields StreamSheet objects one at a time for each sheet.
|
|
361
|
+
# Streaming read: yields StreamSheet objects one at a time for each sheet in the workbook.
|
|
362
|
+
# Keeps memory usage minimal even for multi-gigabyte XLSX files.
|
|
363
|
+
#
|
|
364
|
+
# @example
|
|
365
|
+
# Xlsxrb.foreach("large.xlsx") do |sheet|
|
|
366
|
+
# puts "Sheet: #{sheet.name}"
|
|
367
|
+
# sheet.each_row { |row| process(row) }
|
|
368
|
+
# end
|
|
319
369
|
#
|
|
320
370
|
# @param source [String, IO] File path or IO object.
|
|
321
371
|
# @yield [sheet] Yields each sheet.
|
|
322
372
|
# @yieldparam sheet [StreamSheet] The streaming sheet object.
|
|
323
|
-
# @return [Enumerator]
|
|
324
|
-
# @return [void]
|
|
373
|
+
# @return [Enumerator, void]
|
|
325
374
|
# @api public
|
|
326
375
|
# : (untyped source) ?{ (StreamSheet) -> void } -> untyped
|
|
327
376
|
def self.foreach: (untyped source) ?{ (StreamSheet) -> void } -> untyped
|
|
328
377
|
|
|
329
|
-
# Streaming write: yields a StreamWriter context for
|
|
378
|
+
# Streaming write: yields a StreamWriter context for high-speed, zero-allocation XLSX generation.
|
|
330
379
|
#
|
|
331
|
-
# @
|
|
380
|
+
# @example Generate an Excel file with styles and multiple sheets
|
|
381
|
+
# Xlsxrb.generate("sales.xlsx") do |stream_writer|
|
|
382
|
+
# stream_writer.sheet("Q1") do |sheet|
|
|
383
|
+
# sheet.row(["Product", "Revenue"], styles: :bold)
|
|
384
|
+
# sheet.row(["Widget", 15000])
|
|
385
|
+
# end
|
|
386
|
+
# end
|
|
387
|
+
#
|
|
388
|
+
# @param target [String, IO] File path or IO stream (e.g. pipe, socket, Rails response buffer).
|
|
389
|
+
# @param strict_excel_mode [Boolean] Whether to enforce Excel specifications (max rows/cols/length).
|
|
332
390
|
# @yield [stream_writer]
|
|
333
391
|
# @yieldparam stream_writer [Xlsxrb::StreamWriter]
|
|
334
392
|
# @return [void]
|
|
335
393
|
# @api public
|
|
336
|
-
# : (untyped target, ?strict_excel_mode: bool) ?{ (
|
|
337
|
-
def self.generate: (untyped target, ?strict_excel_mode: bool) ?{ (
|
|
394
|
+
# : (untyped target, ?strict_excel_mode: bool) ?{ (StreamWriter) -> void } -> void
|
|
395
|
+
def self.generate: (untyped target, ?strict_excel_mode: bool) ?{ (StreamWriter) -> void } -> void
|
|
338
396
|
|
|
339
|
-
# Builds an Elements::Workbook
|
|
397
|
+
# Builds an in-memory Elements::Workbook using a declarative DSL.
|
|
340
398
|
#
|
|
399
|
+
# @example Build in-memory workbook
|
|
400
|
+
# workbook = Xlsxrb.build do |builder|
|
|
401
|
+
# builder.sheet("Overview") do |sheet|
|
|
402
|
+
# sheet.row(["Title", "Date"])
|
|
403
|
+
# sheet.row(["Report", Date.today])
|
|
404
|
+
# end
|
|
405
|
+
# end
|
|
406
|
+
#
|
|
407
|
+
# @param strict_excel_mode [Boolean] Whether to enforce Excel specifications.
|
|
341
408
|
# @yield [builder]
|
|
342
409
|
# @yieldparam builder [Xlsxrb::WorkbookBuilder]
|
|
343
410
|
# @return [Elements::Workbook]
|
|
344
411
|
# @api public
|
|
345
|
-
# : (?strict_excel_mode: bool) ?{ (WorkbookBuilder) -> void } ->
|
|
346
|
-
def self.build: (?strict_excel_mode: bool) ?{ (WorkbookBuilder) -> void } ->
|
|
412
|
+
# : (?strict_excel_mode: bool) ?{ (WorkbookBuilder) -> void } -> Elements::Workbook
|
|
413
|
+
def self.build: (?strict_excel_mode: bool) ?{ (WorkbookBuilder) -> void } -> Elements::Workbook
|
|
347
414
|
|
|
348
415
|
# DSL context for Xlsxrb.build.
|
|
349
416
|
# @api public
|
|
@@ -452,9 +519,12 @@ module Xlsxrb
|
|
|
452
519
|
# : (String name, String | Integer | Float | bool | Time value, ?type: ::Symbol) -> void
|
|
453
520
|
def custom_property: (String name, String | Integer | Float | bool | Time value, ?type: ::Symbol) -> void
|
|
454
521
|
|
|
522
|
+
# Builds and returns the in-memory Elements::Workbook.
|
|
523
|
+
#
|
|
524
|
+
# @return [Elements::Workbook]
|
|
455
525
|
# @api public
|
|
456
|
-
# : () ->
|
|
457
|
-
def build: () ->
|
|
526
|
+
# : () -> Elements::Workbook
|
|
527
|
+
def build: () -> Elements::Workbook
|
|
458
528
|
|
|
459
529
|
private
|
|
460
530
|
|
|
@@ -607,8 +677,8 @@ module Xlsxrb
|
|
|
607
677
|
# @param items [Array, nil] Items configuration.
|
|
608
678
|
# @return [void]
|
|
609
679
|
# @api public
|
|
610
|
-
# : (untyped source_ref, **untyped opts) -> void
|
|
611
|
-
def pivot_table: (untyped source_ref, **untyped opts) -> void
|
|
680
|
+
# : (untyped source_ref, row_fields: untyped, data_fields: untyped, ?col_fields: untyped, ?dest_ref: untyped, ?name: untyped, ?field_names: untyped, ?items: untyped, **untyped opts) -> void
|
|
681
|
+
def pivot_table: (untyped source_ref, row_fields: untyped, data_fields: untyped, ?col_fields: untyped, ?dest_ref: untyped, ?name: untyped, ?field_names: untyped, ?items: untyped, **untyped opts) -> void
|
|
612
682
|
|
|
613
683
|
# Add a comment on a cell.
|
|
614
684
|
#
|
|
@@ -627,8 +697,8 @@ module Xlsxrb
|
|
|
627
697
|
# @param opts [Hash] Additional options.
|
|
628
698
|
# @return [void]
|
|
629
699
|
# @api public
|
|
630
|
-
# : (**untyped opts) -> void
|
|
631
|
-
def sparkline_group: (**untyped opts) -> void
|
|
700
|
+
# : (sparklines: untyped, ?type: untyped, **untyped opts) -> void
|
|
701
|
+
def sparkline_group: (sparklines: untyped, ?type: untyped, **untyped opts) -> void
|
|
632
702
|
|
|
633
703
|
# Merge a range of cells (e.g. "A1:B2"), or by coordinate indices.
|
|
634
704
|
#
|
|
@@ -748,9 +818,12 @@ module Xlsxrb
|
|
|
748
818
|
# : (Integer | String col_index) -> void
|
|
749
819
|
def page_break_col: (Integer | String col_index) -> void
|
|
750
820
|
|
|
821
|
+
# Builds and returns the in-memory Elements::Worksheet.
|
|
822
|
+
#
|
|
823
|
+
# @return [Elements::Worksheet]
|
|
751
824
|
# @api public
|
|
752
|
-
# : () ->
|
|
753
|
-
def build: () ->
|
|
825
|
+
# : () -> Elements::Worksheet
|
|
826
|
+
def build: () -> Elements::Worksheet
|
|
754
827
|
|
|
755
828
|
# Internal: returns styles for later processing by WorkbookBuilder
|
|
756
829
|
# : untyped
|
|
@@ -792,247 +865,544 @@ module Xlsxrb
|
|
|
792
865
|
class WorksheetProxy
|
|
793
866
|
def initialize: (untyped writer, untyped sheet_name) -> untyped
|
|
794
867
|
|
|
795
|
-
#
|
|
796
|
-
#
|
|
868
|
+
# Define or configure a named cell style.
|
|
869
|
+
#
|
|
870
|
+
# @example
|
|
871
|
+
# s.style(:header, bold: true, fill_color: "4F81BD", font_color: "FFFFFF")
|
|
872
|
+
#
|
|
873
|
+
# @param name [String, Symbol] The name of the style.
|
|
874
|
+
# @param opts [Hash] Style options (e.g. bold: true, fill_color: "FF0000").
|
|
875
|
+
# @yield [style_builder]
|
|
876
|
+
# @yieldparam style_builder [Xlsxrb::StyleBuilder]
|
|
877
|
+
# @return [Xlsxrb::StyleBuilder]
|
|
797
878
|
# @api public
|
|
798
|
-
# : (
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
#
|
|
804
|
-
#
|
|
879
|
+
# : (String | Symbol name, **untyped opts) ?{ (Xlsxrb::StyleBuilder) -> void } -> Xlsxrb::StyleBuilder
|
|
880
|
+
def style: (String | Symbol name, **untyped opts) ?{ (Xlsxrb::StyleBuilder) -> void } -> Xlsxrb::StyleBuilder
|
|
881
|
+
|
|
882
|
+
# Merge a range of cells.
|
|
883
|
+
#
|
|
884
|
+
# @example Merge with cell reference string
|
|
885
|
+
# s.merge("A1:C1")
|
|
886
|
+
#
|
|
887
|
+
# @example Merge with coordinates
|
|
888
|
+
# s.merge(row: 0, col_start: 0, col_end: 2)
|
|
889
|
+
#
|
|
890
|
+
# @param range [String, nil] The cell range (e.g. "A1:B2").
|
|
891
|
+
# @param row [Integer, nil] 0-based row index.
|
|
892
|
+
# @param col_start [Integer, String, nil] 0-based start column index or letter.
|
|
893
|
+
# @param col_end [Integer, String, nil] 0-based end column index or letter.
|
|
894
|
+
# @param row_start [Integer, nil] 0-based start row index.
|
|
895
|
+
# @param row_end [Integer, nil] 0-based end row index.
|
|
896
|
+
# @return [void]
|
|
805
897
|
# @api public
|
|
806
|
-
# : (
|
|
807
|
-
def merge: (
|
|
808
|
-
|
|
809
|
-
#
|
|
810
|
-
#
|
|
898
|
+
# : (?String? range, ?row: Integer | nil, ?col_start: (Integer | String)?, ?col_end: (Integer | String)?, ?row_start: Integer | nil, ?row_end: Integer | nil) -> void
|
|
899
|
+
def merge: (?String? range, ?row: Integer | nil, ?col_start: (Integer | String)?, ?col_end: (Integer | String)?, ?row_start: Integer | nil, ?row_end: Integer | nil) -> void
|
|
900
|
+
|
|
901
|
+
# Add a drawing shape to the sheet.
|
|
902
|
+
#
|
|
903
|
+
# @example
|
|
904
|
+
# s.shape(preset: "ellipse", text: "Circle", from_col: 1, from_row: 1, to_col: 4, to_row: 5)
|
|
905
|
+
#
|
|
906
|
+
# @param preset [String] Preset shape type (e.g. "rect", "ellipse").
|
|
907
|
+
# @param text [String, nil] Shape label text.
|
|
908
|
+
# @param from_col [Integer] Starting column index (0-based).
|
|
909
|
+
# @param from_row [Integer] Starting row index (0-based).
|
|
910
|
+
# @param to_col [Integer] Ending column index (0-based).
|
|
911
|
+
# @param to_row [Integer] Ending row index (0-based).
|
|
912
|
+
# @param opts [Hash] Additional shape formatting options.
|
|
913
|
+
# @return [void]
|
|
811
914
|
# @api public
|
|
812
|
-
# : (
|
|
813
|
-
def shape: (
|
|
915
|
+
# : (?preset: String, ?text: String?, ?from_col: Integer, ?from_row: Integer, ?to_col: Integer, ?to_row: Integer, **untyped opts) -> void
|
|
916
|
+
def shape: (?preset: String, ?text: String?, ?from_col: Integer, ?from_row: Integer, ?to_col: Integer, ?to_row: Integer, **untyped opts) -> void
|
|
814
917
|
|
|
815
|
-
#
|
|
816
|
-
#
|
|
817
|
-
# @api public
|
|
918
|
+
# simplecov:disable
|
|
919
|
+
# Edge case / untested delegation block
|
|
818
920
|
# : (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
819
921
|
def internal_sheet_setup: (*untyped args, **untyped kwargs) ?{ (*untyped) -> untyped } -> untyped
|
|
820
922
|
|
|
821
|
-
#
|
|
822
|
-
#
|
|
923
|
+
# Add a row to the active sheet.
|
|
924
|
+
#
|
|
925
|
+
# @example Write an array of values
|
|
926
|
+
# s.row(["Name", "Age", "City"])
|
|
927
|
+
#
|
|
928
|
+
# @example Write with explicit column keys and styles
|
|
929
|
+
# s.row({ A: "Header", C: 100 }, styles: { A: :bold })
|
|
930
|
+
#
|
|
931
|
+
# @param values [Array, Hash] The cell values (e.g. `[1, 2, 3]` or `{ A: 1, C: 3 }`).
|
|
932
|
+
# @param styles [String, Symbol, Array, Hash, nil] Style names or hashes to apply.
|
|
933
|
+
# @param height [Float, Integer, nil] The row height in points (0 - 409).
|
|
934
|
+
# @param hidden [Boolean] Whether the row is hidden.
|
|
935
|
+
# @param custom_height [Boolean] Whether to flag as custom height.
|
|
936
|
+
# @param outline_level [Integer, nil] Grouping/outline level (0 - 7).
|
|
937
|
+
# @return [void]
|
|
823
938
|
# @api public
|
|
824
|
-
# : (
|
|
825
|
-
def row: (
|
|
826
|
-
|
|
827
|
-
#
|
|
828
|
-
#
|
|
939
|
+
# : (Array[untyped] | Hash[untyped, untyped] values, ?styles: untyped, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?outline_level: Integer | nil) -> void
|
|
940
|
+
def row: (Array[untyped] | Hash[untyped, untyped] values, ?styles: untyped, ?height: Float | Integer | nil, ?hidden: bool, ?custom_height: bool, ?outline_level: Integer | nil) -> void
|
|
941
|
+
|
|
942
|
+
# Configure column width and properties.
|
|
943
|
+
#
|
|
944
|
+
# @example Set column A width
|
|
945
|
+
# s.column(0, width: 25.0)
|
|
946
|
+
#
|
|
947
|
+
# @param col_index [Integer, String, Symbol] 0-based column index or letter (e.g. 0 or "A" or :A).
|
|
948
|
+
# @param width [Float, Integer, nil] Column width in characters.
|
|
949
|
+
# @param hidden [Boolean] Whether the column is hidden.
|
|
950
|
+
# @param best_fit [Boolean] Whether the column automatically fits content.
|
|
951
|
+
# @param custom_width [Boolean] Whether to flag as custom width.
|
|
952
|
+
# @param outline_level [Integer, nil] Grouping/outline level (0 - 7).
|
|
953
|
+
# @param collapsed [Boolean] Whether the outline group is collapsed.
|
|
954
|
+
# @return [void]
|
|
829
955
|
# @api public
|
|
830
|
-
# : (
|
|
831
|
-
def column: (
|
|
832
|
-
|
|
833
|
-
#
|
|
834
|
-
#
|
|
956
|
+
# : (Integer | String | Symbol col_index, ?width: Float | Integer | nil, ?hidden: bool, ?best_fit: bool, ?custom_width: bool, ?outline_level: Integer | nil, ?collapsed: bool) -> void
|
|
957
|
+
def column: (Integer | String | Symbol col_index, ?width: Float | Integer | nil, ?hidden: bool, ?best_fit: bool, ?custom_width: bool, ?outline_level: Integer | nil, ?collapsed: bool) -> void
|
|
958
|
+
|
|
959
|
+
# Add a chart to the sheet.
|
|
960
|
+
#
|
|
961
|
+
# @example
|
|
962
|
+
# s.chart(:bar) do |chart_builder|
|
|
963
|
+
# chart_builder.title("Quarterly Sales")
|
|
964
|
+
# chart_builder.series(values: "Sheet1!$B$2:$B$5", categories: "Sheet1!$A$2:$A$5", name: "Revenue")
|
|
965
|
+
# end
|
|
966
|
+
#
|
|
967
|
+
# @param type [Symbol, String, nil] The chart type (:bar, :col, :line, :pie, :scatter, :area, :doughnut, :radar).
|
|
968
|
+
# @param opts [Hash] Additional chart options.
|
|
969
|
+
# @yield [chart_builder]
|
|
970
|
+
# @yieldparam chart_builder [Xlsxrb::ChartBuilder]
|
|
971
|
+
# @return [void]
|
|
835
972
|
# @api public
|
|
836
|
-
# : (
|
|
837
|
-
def chart: (
|
|
838
|
-
|
|
839
|
-
#
|
|
840
|
-
#
|
|
973
|
+
# : (?Symbol | String? type, **untyped opts) ?{ (Xlsxrb::ChartBuilder) -> void } -> void
|
|
974
|
+
def chart: (?Symbol | String? type, **untyped opts) ?{ (Xlsxrb::ChartBuilder) -> void } -> void
|
|
975
|
+
|
|
976
|
+
# Add a hyperlink to a cell.
|
|
977
|
+
#
|
|
978
|
+
# @example Positional URL
|
|
979
|
+
# s.hyperlink("A1", "https://example.com", display: "Example")
|
|
980
|
+
#
|
|
981
|
+
# @example Keyword location
|
|
982
|
+
# s.hyperlink("A1", location: "https://example.com", tooltip: "Go to Example")
|
|
983
|
+
#
|
|
984
|
+
# @param cell [String] The cell reference (e.g. "A1").
|
|
985
|
+
# @param url [String, nil] The target URL or URI.
|
|
986
|
+
# @param display [String, nil] Display text for the link.
|
|
987
|
+
# @param tooltip [String, nil] Tooltip text when hovering.
|
|
988
|
+
# @param location [String, nil] Destination location / URL (keyword alternative).
|
|
989
|
+
# @return [void]
|
|
841
990
|
# @api public
|
|
842
|
-
# : (
|
|
843
|
-
def hyperlink: (
|
|
844
|
-
|
|
845
|
-
#
|
|
846
|
-
#
|
|
991
|
+
# : (String cell, ?String? url, ?display: String?, ?tooltip: String?, ?location: String?) -> void
|
|
992
|
+
def hyperlink: (String cell, ?String? url, ?display: String?, ?tooltip: String?, ?location: String?) -> void
|
|
993
|
+
|
|
994
|
+
# Set the auto-filter range on the sheet.
|
|
995
|
+
#
|
|
996
|
+
# @example
|
|
997
|
+
# s.auto_filter("A1:D100")
|
|
998
|
+
#
|
|
999
|
+
# @param ref [String] The cell range (e.g. "A1:D10").
|
|
1000
|
+
# @return [void]
|
|
847
1001
|
# @api public
|
|
848
|
-
# : (
|
|
849
|
-
def auto_filter: (
|
|
850
|
-
|
|
851
|
-
#
|
|
852
|
-
#
|
|
1002
|
+
# : (String ref) -> void
|
|
1003
|
+
def auto_filter: (String ref) -> void
|
|
1004
|
+
|
|
1005
|
+
# Set filter criteria for a column in the auto-filter.
|
|
1006
|
+
#
|
|
1007
|
+
# @example Simple values filter
|
|
1008
|
+
# s.filter_column(0, ["Active", "Pending"])
|
|
1009
|
+
#
|
|
1010
|
+
# @example Custom filter specification
|
|
1011
|
+
# s.filter_column(0, { type: :filters, values: ["Data"] })
|
|
1012
|
+
#
|
|
1013
|
+
# @param col_id [Integer] 0-based column index relative to auto-filter range.
|
|
1014
|
+
# @param filter_values [Array<String>, Hash] Values or filter specification hash.
|
|
1015
|
+
# @return [void]
|
|
853
1016
|
# @api public
|
|
854
|
-
# : (
|
|
855
|
-
def filter_column: (
|
|
856
|
-
|
|
857
|
-
#
|
|
858
|
-
#
|
|
1017
|
+
# : (Integer col_id, Array[String] | Hash[Symbol, untyped] filter_values) -> void
|
|
1018
|
+
def filter_column: (Integer col_id, Array[String] | Hash[Symbol, untyped] filter_values) -> void
|
|
1019
|
+
|
|
1020
|
+
# Configure sort state on a range.
|
|
1021
|
+
#
|
|
1022
|
+
# @example
|
|
1023
|
+
# s.sort_state("A1:A10", [{ ref: "A1:A10", descending: true }])
|
|
1024
|
+
#
|
|
1025
|
+
# @param ref [String] The range to sort.
|
|
1026
|
+
# @param sort_conditions [Array<Hash>, Hash] Sort conditions array or options hash.
|
|
1027
|
+
# @param opts [Hash] Additional sort options.
|
|
1028
|
+
# @return [void]
|
|
859
1029
|
# @api public
|
|
860
|
-
# : (
|
|
861
|
-
def sort_state: (
|
|
862
|
-
|
|
863
|
-
#
|
|
864
|
-
#
|
|
1030
|
+
# : (String ref, Array[Hash[Symbol, untyped]] | Hash[Symbol, untyped] sort_conditions, **untyped opts) -> void
|
|
1031
|
+
def sort_state: (String ref, Array[Hash[Symbol, untyped]] | Hash[Symbol, untyped] sort_conditions, **untyped opts) -> void
|
|
1032
|
+
|
|
1033
|
+
# Add data validation rules to a range.
|
|
1034
|
+
#
|
|
1035
|
+
# @example Dropdown list validation
|
|
1036
|
+
# s.validate_data("B2:B100", type: "list", formula1: '"High,Medium,Low"')
|
|
1037
|
+
#
|
|
1038
|
+
# @example Integer range validation
|
|
1039
|
+
# s.validate_data("C2:C100", type: "whole", operator: "between", formula1: 1, formula2: 100)
|
|
1040
|
+
#
|
|
1041
|
+
# @param range [String] The cell range (e.g. "B2:B10").
|
|
1042
|
+
# @param type [String, Symbol] Validation type ("list", "whole", "decimal", "date", "time", "textLength", "custom").
|
|
1043
|
+
# @param opts [Hash] Validation options.
|
|
1044
|
+
# @return [void]
|
|
865
1045
|
# @api public
|
|
866
|
-
# : (
|
|
867
|
-
def validate_data: (
|
|
868
|
-
|
|
869
|
-
#
|
|
870
|
-
#
|
|
1046
|
+
# : (String range, ?type: String | Symbol, **untyped opts) -> void
|
|
1047
|
+
def validate_data: (String range, ?type: String | Symbol, **untyped opts) -> void
|
|
1048
|
+
|
|
1049
|
+
# Add conditional formatting to a range.
|
|
1050
|
+
#
|
|
1051
|
+
# @example Highlight values greater than 100
|
|
1052
|
+
# s.conditional_format("A1:A10", type: "cellIs", operator: "greaterThan", formula: 100, style: :highlight)
|
|
1053
|
+
#
|
|
1054
|
+
# @param range [String] The cell range (e.g. "A1:A10").
|
|
1055
|
+
# @param type [String, Symbol] Rule type ("cellIs", "colorScale", "dataBar", "expression").
|
|
1056
|
+
# @param opts [Hash] Rule options.
|
|
1057
|
+
# @return [void]
|
|
871
1058
|
# @api public
|
|
872
|
-
# : (
|
|
873
|
-
def conditional_format: (
|
|
874
|
-
|
|
875
|
-
#
|
|
876
|
-
#
|
|
1059
|
+
# : (String range, ?type: String | Symbol, **untyped opts) -> void
|
|
1060
|
+
def conditional_format: (String range, ?type: String | Symbol, **untyped opts) -> void
|
|
1061
|
+
|
|
1062
|
+
# Add a formatted Excel Table to the sheet.
|
|
1063
|
+
#
|
|
1064
|
+
# @example
|
|
1065
|
+
# s.table("A1:C10", columns: ["ID", "Name", "Total"], name: "SalesTable", style: "TableStyleMedium9")
|
|
1066
|
+
#
|
|
1067
|
+
# @param ref [String] The cell range for the table (e.g. "A1:D10").
|
|
1068
|
+
# @param columns [Array<String>, Array<Hash>] Column names or definitions.
|
|
1069
|
+
# @param name [String, nil] Table name.
|
|
1070
|
+
# @param display_name [String, nil] Display name.
|
|
1071
|
+
# @param style [String, nil] Table style name.
|
|
1072
|
+
# @param opts [Hash] Additional options.
|
|
1073
|
+
# @return [void]
|
|
877
1074
|
# @api public
|
|
878
|
-
# : (
|
|
879
|
-
def table: (
|
|
1075
|
+
# : (String ref, columns: untyped, ?name: String?, ?display_name: String?, ?style: String?, **untyped opts) -> void
|
|
1076
|
+
def table: (String ref, columns: untyped, ?name: String?, ?display_name: String?, ?style: String?, **untyped opts) -> void
|
|
880
1077
|
|
|
881
|
-
#
|
|
882
|
-
#
|
|
1078
|
+
# simplecov:disable
|
|
1079
|
+
# Edge case / untested delegation block
|
|
1080
|
+
# : () -> void
|
|
1081
|
+
def cleanup!: () -> void
|
|
1082
|
+
|
|
1083
|
+
# Add a comment to a cell.
|
|
1084
|
+
#
|
|
1085
|
+
# @example
|
|
1086
|
+
# s.comment("A1", "Reviewed and approved", author: "Auditor")
|
|
1087
|
+
#
|
|
1088
|
+
# @param cell [String, Integer] The cell reference (e.g. "A1").
|
|
1089
|
+
# @param text [String] The comment text.
|
|
1090
|
+
# @param author [String] The author name.
|
|
1091
|
+
# @return [void]
|
|
883
1092
|
# @api public
|
|
884
|
-
# : (
|
|
885
|
-
def
|
|
886
|
-
|
|
887
|
-
#
|
|
888
|
-
#
|
|
1093
|
+
# : (String | Integer cell, String text, ?author: String) -> void
|
|
1094
|
+
def comment: (String | Integer cell, String text, ?author: String) -> void
|
|
1095
|
+
|
|
1096
|
+
# Add a Pivot Table to the sheet.
|
|
1097
|
+
#
|
|
1098
|
+
# @example
|
|
1099
|
+
# s.pivot_table("Sheet1!A1:D100", row_fields: ["Category"], data_fields: ["Amount"], dest_ref: "F1")
|
|
1100
|
+
#
|
|
1101
|
+
# @param source_ref [String] Source data range reference (e.g. "Sheet1!A1:D100").
|
|
1102
|
+
# @param row_fields [Array<String>] Field names for rows.
|
|
1103
|
+
# @param data_fields [Array<String>] Field names for data values.
|
|
1104
|
+
# @param col_fields [Array<String>] Field names for columns.
|
|
1105
|
+
# @param dest_ref [String] Target top-left cell reference (default: "E1").
|
|
1106
|
+
# @param name [String, nil] Pivot table name.
|
|
1107
|
+
# @param field_names [Array<String>, nil] Override field names.
|
|
1108
|
+
# @param items [Array, nil] Items configuration.
|
|
1109
|
+
# @param opts [Hash] Additional options.
|
|
1110
|
+
# @return [void]
|
|
889
1111
|
# @api public
|
|
890
|
-
# : (
|
|
891
|
-
def
|
|
892
|
-
|
|
893
|
-
#
|
|
894
|
-
#
|
|
1112
|
+
# : (String source_ref, row_fields: untyped, data_fields: untyped, ?col_fields: untyped, ?dest_ref: String, ?name: String?, ?field_names: untyped, ?items: untyped, **untyped opts) -> void
|
|
1113
|
+
def pivot_table: (String source_ref, row_fields: untyped, data_fields: untyped, ?col_fields: untyped, ?dest_ref: String, ?name: String?, ?field_names: untyped, ?items: untyped, **untyped opts) -> void
|
|
1114
|
+
|
|
1115
|
+
# Add sparklines to the sheet.
|
|
1116
|
+
#
|
|
1117
|
+
# @example
|
|
1118
|
+
# s.sparkline_group(sparklines: [{ data_ref: "A1:E1", location_ref: "F1" }], type: "line")
|
|
1119
|
+
#
|
|
1120
|
+
# @param sparklines [Array<Hash>] Array of { data_ref:, location_ref: } hashes.
|
|
1121
|
+
# @param type [String, nil] "line" (default), "column", or "stacked".
|
|
1122
|
+
# @param opts [Hash] Additional sparkline options.
|
|
1123
|
+
# @return [void]
|
|
895
1124
|
# @api public
|
|
896
|
-
# : (
|
|
897
|
-
def
|
|
1125
|
+
# : (sparklines: Array[Hash[Symbol, untyped]], ?type: String?, **untyped opts) -> void
|
|
1126
|
+
def sparkline_group: (sparklines: Array[Hash[Symbol, untyped]], ?type: String?, **untyped opts) -> void
|
|
898
1127
|
|
|
899
|
-
#
|
|
900
|
-
#
|
|
1128
|
+
# Set workbook-level properties.
|
|
1129
|
+
#
|
|
1130
|
+
# @param opts [Hash] Workbook property options.
|
|
1131
|
+
# @return [void]
|
|
901
1132
|
# @api public
|
|
902
|
-
# : (
|
|
903
|
-
def
|
|
904
|
-
|
|
905
|
-
#
|
|
906
|
-
#
|
|
1133
|
+
# : (**untyped opts) -> void
|
|
1134
|
+
def workbook_property: (**untyped opts) -> void
|
|
1135
|
+
|
|
1136
|
+
# Set sheet properties (e.g. tab color, page setup flags).
|
|
1137
|
+
#
|
|
1138
|
+
# @example
|
|
1139
|
+
# s.sheet_properties(:tab_color, "FF0000")
|
|
1140
|
+
#
|
|
1141
|
+
# @param name [Symbol, String] Property name.
|
|
1142
|
+
# @param value [Object] Property value.
|
|
1143
|
+
# @return [void]
|
|
907
1144
|
# @api public
|
|
908
|
-
# : (
|
|
909
|
-
def
|
|
910
|
-
|
|
911
|
-
#
|
|
912
|
-
#
|
|
1145
|
+
# : (Symbol | String name, untyped value) -> void
|
|
1146
|
+
def sheet_properties: (Symbol | String name, untyped value) -> void
|
|
1147
|
+
|
|
1148
|
+
# Add a defined named range or formula.
|
|
1149
|
+
#
|
|
1150
|
+
# @example
|
|
1151
|
+
# s.defined_name("TaxRate", "0.10")
|
|
1152
|
+
#
|
|
1153
|
+
# @param name [String] The name.
|
|
1154
|
+
# @param formula [String] The formula or range expression.
|
|
1155
|
+
# @param sheet_id [Integer, nil] Optional sheet scope.
|
|
1156
|
+
# @param hidden [Boolean] Whether the name is hidden.
|
|
1157
|
+
# @return [void]
|
|
913
1158
|
# @api public
|
|
914
|
-
# : (
|
|
915
|
-
def
|
|
916
|
-
|
|
917
|
-
#
|
|
918
|
-
#
|
|
1159
|
+
# : (String name, String formula, ?sheet_id: Integer | nil, ?hidden: bool) -> void
|
|
1160
|
+
def defined_name: (String name, String formula, ?sheet_id: Integer | nil, ?hidden: bool) -> void
|
|
1161
|
+
|
|
1162
|
+
# Freeze rows and/or columns for scrolling.
|
|
1163
|
+
#
|
|
1164
|
+
# @example Freeze top row
|
|
1165
|
+
# s.freeze_pane(row: 1)
|
|
1166
|
+
#
|
|
1167
|
+
# @example Freeze first column and top 2 rows
|
|
1168
|
+
# s.freeze_pane(row: 2, col: 1)
|
|
1169
|
+
#
|
|
1170
|
+
# @param row [Integer, nil] Number of rows to freeze.
|
|
1171
|
+
# @param col [Integer, nil] Number of columns to freeze.
|
|
1172
|
+
# @return [void]
|
|
919
1173
|
# @api public
|
|
920
|
-
# : (
|
|
921
|
-
def
|
|
922
|
-
|
|
923
|
-
#
|
|
924
|
-
#
|
|
1174
|
+
# : (?row: Integer | nil, ?col: Integer | nil) -> void
|
|
1175
|
+
def freeze_pane: (?row: Integer | nil, ?col: Integer | nil) -> void
|
|
1176
|
+
|
|
1177
|
+
# simplecov:disable
|
|
1178
|
+
# Edge case / untested delegation block
|
|
1179
|
+
# Set the print area range for the sheet.
|
|
1180
|
+
#
|
|
1181
|
+
# @example
|
|
1182
|
+
# s.print_area("A1:G50")
|
|
1183
|
+
#
|
|
1184
|
+
# @param ref [String] Range reference.
|
|
1185
|
+
# @return [void]
|
|
925
1186
|
# @api public
|
|
926
|
-
# : (
|
|
927
|
-
def
|
|
928
|
-
|
|
929
|
-
#
|
|
930
|
-
#
|
|
1187
|
+
# : (String ref) -> void
|
|
1188
|
+
def print_area: (String ref) -> void
|
|
1189
|
+
|
|
1190
|
+
# simplecov:disable
|
|
1191
|
+
# Edge case / untested delegation block
|
|
1192
|
+
# Configure repeating title rows and columns for printing.
|
|
1193
|
+
#
|
|
1194
|
+
# @example Repeat top 2 rows on every page
|
|
1195
|
+
# s.print_titles(rows: "1:2")
|
|
1196
|
+
#
|
|
1197
|
+
# @param rows [String, nil] Row range to repeat (e.g. "1:2").
|
|
1198
|
+
# @param cols [String, nil] Column range to repeat (e.g. "A:B").
|
|
1199
|
+
# @return [void]
|
|
931
1200
|
# @api public
|
|
932
|
-
# : (
|
|
933
|
-
def
|
|
934
|
-
|
|
935
|
-
#
|
|
936
|
-
#
|
|
1201
|
+
# : (?rows: String?, ?cols: String?) -> void
|
|
1202
|
+
def print_titles: (?rows: String?, ?cols: String?) -> void
|
|
1203
|
+
|
|
1204
|
+
# Split sheet view into panes.
|
|
1205
|
+
#
|
|
1206
|
+
# @param x_split [Numeric, nil] Horizontal split position.
|
|
1207
|
+
# @param y_split [Numeric, nil] Vertical split position.
|
|
1208
|
+
# @param top_left_cell [String, nil] Top-left visible cell in bottom-right pane.
|
|
1209
|
+
# @param active_pane [String, nil] Active pane identifier.
|
|
1210
|
+
# @param state [String, nil] Split state.
|
|
1211
|
+
# @return [void]
|
|
937
1212
|
# @api public
|
|
938
|
-
# : (
|
|
939
|
-
def
|
|
940
|
-
|
|
941
|
-
#
|
|
942
|
-
#
|
|
1213
|
+
# : (?x_split: Numeric | nil, ?y_split: Numeric | nil, ?top_left_cell: String?, ?active_pane: String?, ?state: String?) -> void
|
|
1214
|
+
def split_pane: (?x_split: Numeric | nil, ?y_split: Numeric | nil, ?top_left_cell: String?, ?active_pane: String?, ?state: String?) -> void
|
|
1215
|
+
|
|
1216
|
+
# simplecov:disable
|
|
1217
|
+
# Edge case / untested delegation block
|
|
1218
|
+
# Protect the workbook structure.
|
|
1219
|
+
#
|
|
1220
|
+
# @param opts [Hash] Protection options.
|
|
1221
|
+
# @return [void]
|
|
943
1222
|
# @api public
|
|
944
|
-
# : (
|
|
945
|
-
def
|
|
946
|
-
|
|
947
|
-
#
|
|
948
|
-
#
|
|
949
|
-
#
|
|
950
|
-
#
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
#
|
|
954
|
-
# @see StreamWriter#core_property
|
|
1223
|
+
# : (**untyped opts) -> void
|
|
1224
|
+
def protect_workbook: (**untyped opts) -> void
|
|
1225
|
+
|
|
1226
|
+
# simplecov:disable
|
|
1227
|
+
# Edge case / untested delegation block
|
|
1228
|
+
# Set core metadata property.
|
|
1229
|
+
#
|
|
1230
|
+
# @param name [String, Symbol] Property name.
|
|
1231
|
+
# @param value [Object] Property value.
|
|
1232
|
+
# @return [void]
|
|
955
1233
|
# @api public
|
|
956
|
-
# : (
|
|
957
|
-
def core_property: (
|
|
958
|
-
|
|
959
|
-
#
|
|
960
|
-
#
|
|
1234
|
+
# : (String | Symbol name, untyped value) -> void
|
|
1235
|
+
def core_property: (String | Symbol name, untyped value) -> void
|
|
1236
|
+
|
|
1237
|
+
# Set the active/selected cell on the sheet.
|
|
1238
|
+
#
|
|
1239
|
+
# @example
|
|
1240
|
+
# s.select_cell("B5")
|
|
1241
|
+
# s.select_cell("A1", sqref: "A1:A2", pane: "topRight")
|
|
1242
|
+
#
|
|
1243
|
+
# @param active_cell [String] Cell reference (e.g. "A1").
|
|
1244
|
+
# @param sqref [String, nil] Selection range.
|
|
1245
|
+
# @param pane [String, Symbol, nil] Pane identifier.
|
|
1246
|
+
# @return [void]
|
|
961
1247
|
# @api public
|
|
962
|
-
# : (
|
|
963
|
-
def select_cell: (
|
|
964
|
-
|
|
965
|
-
#
|
|
966
|
-
#
|
|
1248
|
+
# : (String active_cell, ?sqref: String?, ?pane: (String | Symbol)?) -> void
|
|
1249
|
+
def select_cell: (String active_cell, ?sqref: String?, ?pane: (String | Symbol)?) -> void
|
|
1250
|
+
|
|
1251
|
+
# Configure page margins for printing.
|
|
1252
|
+
#
|
|
1253
|
+
# @example
|
|
1254
|
+
# s.page_margins(left: 0.7, right: 0.7, top: 0.75, bottom: 0.75)
|
|
1255
|
+
#
|
|
1256
|
+
# @param left [Float, nil] Left margin in inches.
|
|
1257
|
+
# @param right [Float, nil] Right margin in inches.
|
|
1258
|
+
# @param top [Float, nil] Top margin in inches.
|
|
1259
|
+
# @param bottom [Float, nil] Bottom margin in inches.
|
|
1260
|
+
# @param header [Float, nil] Header margin in inches.
|
|
1261
|
+
# @param footer [Float, nil] Footer margin in inches.
|
|
1262
|
+
# @return [void]
|
|
967
1263
|
# @api public
|
|
968
|
-
# : (
|
|
969
|
-
def page_margins: (
|
|
970
|
-
|
|
971
|
-
#
|
|
972
|
-
#
|
|
1264
|
+
# : (?left: Float | nil, ?right: Float | nil, ?top: Float | nil, ?bottom: Float | nil, ?header: Float | nil, ?footer: Float | nil) -> void
|
|
1265
|
+
def page_margins: (?left: Float | nil, ?right: Float | nil, ?top: Float | nil, ?bottom: Float | nil, ?header: Float | nil, ?footer: Float | nil) -> void
|
|
1266
|
+
|
|
1267
|
+
# Configure page orientation, paper size, and print setup.
|
|
1268
|
+
#
|
|
1269
|
+
# @example Landscape A4
|
|
1270
|
+
# s.page_setup(orientation: "landscape", paper_size: 9)
|
|
1271
|
+
#
|
|
1272
|
+
# @param orientation [String, Symbol, nil] "portrait" or "landscape" (or :portrait, :landscape).
|
|
1273
|
+
# @param paper_size [Integer, nil] Paper size index (e.g. 9 for A4, 1 for Letter).
|
|
1274
|
+
# @param opts [Hash] Additional options (scale, fit_to_width, fit_to_height).
|
|
1275
|
+
# @return [void]
|
|
973
1276
|
# @api public
|
|
974
|
-
# : (
|
|
975
|
-
def page_setup: (
|
|
976
|
-
|
|
977
|
-
#
|
|
978
|
-
#
|
|
1277
|
+
# : (?orientation: (String | Symbol)?, ?paper_size: Integer | nil, **untyped opts) -> void
|
|
1278
|
+
def page_setup: (?orientation: (String | Symbol)?, ?paper_size: Integer | nil, **untyped opts) -> void
|
|
1279
|
+
|
|
1280
|
+
# Configure header and footer text for printing.
|
|
1281
|
+
#
|
|
1282
|
+
# @example
|
|
1283
|
+
# s.header_footer(odd_header: "&CConfidential", odd_footer: "&RPage &P of &N")
|
|
1284
|
+
#
|
|
1285
|
+
# @param opts [Hash] Header and footer specifications.
|
|
1286
|
+
# @return [void]
|
|
979
1287
|
# @api public
|
|
980
|
-
# : (
|
|
981
|
-
def header_footer: (
|
|
982
|
-
|
|
983
|
-
#
|
|
984
|
-
#
|
|
1288
|
+
# : (**untyped opts) -> void
|
|
1289
|
+
def header_footer: (**untyped opts) -> void
|
|
1290
|
+
|
|
1291
|
+
# Configure print options (e.g. gridlines, headings).
|
|
1292
|
+
#
|
|
1293
|
+
# @example
|
|
1294
|
+
# s.print_options(:grid_lines, true)
|
|
1295
|
+
#
|
|
1296
|
+
# @param name [Symbol, String] Print option name.
|
|
1297
|
+
# @param value [Object] Print option value.
|
|
1298
|
+
# @return [void]
|
|
985
1299
|
# @api public
|
|
986
|
-
# : (
|
|
987
|
-
def print_options: (
|
|
988
|
-
|
|
989
|
-
#
|
|
990
|
-
#
|
|
1300
|
+
# : (Symbol | String name, untyped value) -> void
|
|
1301
|
+
def print_options: (Symbol | String name, untyped value) -> void
|
|
1302
|
+
|
|
1303
|
+
# simplecov:disable
|
|
1304
|
+
# Edge case / untested delegation block
|
|
1305
|
+
# Set document metadata properties (core, app, custom).
|
|
1306
|
+
#
|
|
1307
|
+
# @example
|
|
1308
|
+
# s.properties(core: { title: "Report", creator: "App" })
|
|
1309
|
+
#
|
|
1310
|
+
# @param core [Hash, nil] Core properties (title, creator, subject, etc.).
|
|
1311
|
+
# @param app [Hash, nil] App properties (company, manager).
|
|
1312
|
+
# @param custom [Hash, nil] Custom properties.
|
|
1313
|
+
# @return [void]
|
|
991
1314
|
# @api public
|
|
992
|
-
# : (
|
|
993
|
-
def properties: (
|
|
994
|
-
|
|
995
|
-
#
|
|
996
|
-
#
|
|
1315
|
+
# : (?core: Hash[untyped, untyped]?, ?app: Hash[untyped, untyped]?, ?custom: Hash[untyped, untyped]?) -> void
|
|
1316
|
+
def properties: (?core: Hash[untyped, untyped]?, ?app: Hash[untyped, untyped]?, ?custom: Hash[untyped, untyped]?) -> void
|
|
1317
|
+
|
|
1318
|
+
# simplecov:disable
|
|
1319
|
+
# Edge case / untested delegation block
|
|
1320
|
+
# Set app metadata property.
|
|
1321
|
+
#
|
|
1322
|
+
# @param name [String, Symbol] Property name.
|
|
1323
|
+
# @param value [Object] Property value.
|
|
1324
|
+
# @return [void]
|
|
997
1325
|
# @api public
|
|
998
|
-
# : (
|
|
999
|
-
def app_property: (
|
|
1000
|
-
|
|
1001
|
-
#
|
|
1002
|
-
#
|
|
1326
|
+
# : (String | Symbol name, untyped value) -> void
|
|
1327
|
+
def app_property: (String | Symbol name, untyped value) -> void
|
|
1328
|
+
|
|
1329
|
+
# Protect the worksheet against modifications.
|
|
1330
|
+
#
|
|
1331
|
+
# @example
|
|
1332
|
+
# s.protect_sheet(password: "secret", select_locked_cells: true)
|
|
1333
|
+
#
|
|
1334
|
+
# @param opts [Hash] Protection options.
|
|
1335
|
+
# @return [void]
|
|
1003
1336
|
# @api public
|
|
1004
|
-
# : (
|
|
1005
|
-
def protect_sheet: (
|
|
1006
|
-
|
|
1007
|
-
#
|
|
1008
|
-
#
|
|
1337
|
+
# : (**untyped opts) -> void
|
|
1338
|
+
def protect_sheet: (**untyped opts) -> void
|
|
1339
|
+
|
|
1340
|
+
# simplecov:disable
|
|
1341
|
+
# Edge case / untested delegation block
|
|
1342
|
+
# Set custom metadata property.
|
|
1343
|
+
#
|
|
1344
|
+
# @param name [String, Symbol] Property name.
|
|
1345
|
+
# @param value [Object] Property value.
|
|
1346
|
+
# @return [void]
|
|
1009
1347
|
# @api public
|
|
1010
|
-
# : (
|
|
1011
|
-
def custom_property: (
|
|
1012
|
-
|
|
1013
|
-
#
|
|
1014
|
-
#
|
|
1348
|
+
# : (String | Symbol name, untyped value) -> void
|
|
1349
|
+
def custom_property: (String | Symbol name, untyped value) -> void
|
|
1350
|
+
|
|
1351
|
+
# Insert an image into the sheet.
|
|
1352
|
+
#
|
|
1353
|
+
# @example
|
|
1354
|
+
# s.image(File.read("logo.png"), ext: "png", from_col: 0, from_row: 0, to_col: 2, to_row: 3)
|
|
1355
|
+
#
|
|
1356
|
+
# @param file_data [String] Binary image data or file content.
|
|
1357
|
+
# @param ext [String] Image extension ("png", "jpeg", etc.).
|
|
1358
|
+
# @param from_col [Integer] Starting column index (0-based).
|
|
1359
|
+
# @param from_row [Integer] Starting row index (0-based).
|
|
1360
|
+
# @param to_col [Integer] Ending column index (0-based).
|
|
1361
|
+
# @param to_row [Integer] Ending row index (0-based).
|
|
1362
|
+
# @param opts [Hash] Additional anchor and sizing options.
|
|
1363
|
+
# @return [void]
|
|
1015
1364
|
# @api public
|
|
1016
|
-
# : (
|
|
1017
|
-
def image: (
|
|
1018
|
-
|
|
1019
|
-
#
|
|
1020
|
-
#
|
|
1365
|
+
# : (String file_data, ?ext: String, ?from_col: Integer, ?from_row: Integer, ?to_col: Integer, ?to_row: Integer, **untyped opts) -> void
|
|
1366
|
+
def image: (String file_data, ?ext: String, ?from_col: Integer, ?from_row: Integer, ?to_col: Integer, ?to_row: Integer, **untyped opts) -> void
|
|
1367
|
+
|
|
1368
|
+
# Configure sheet view settings (zoom scale, grid lines visibility).
|
|
1369
|
+
#
|
|
1370
|
+
# @example
|
|
1371
|
+
# s.sheet_view(:show_grid_lines, false)
|
|
1372
|
+
# s.sheet_view(:zoom_scale, 120)
|
|
1373
|
+
#
|
|
1374
|
+
# @param name [Symbol, String] View setting name.
|
|
1375
|
+
# @param value [Object] View setting value.
|
|
1376
|
+
# @return [void]
|
|
1021
1377
|
# @api public
|
|
1022
|
-
# : (
|
|
1023
|
-
def sheet_view: (
|
|
1024
|
-
|
|
1025
|
-
#
|
|
1026
|
-
#
|
|
1378
|
+
# : (Symbol | String name, untyped value) -> void
|
|
1379
|
+
def sheet_view: (Symbol | String name, untyped value) -> void
|
|
1380
|
+
|
|
1381
|
+
# simplecov:disable
|
|
1382
|
+
# Edge case / untested delegation block
|
|
1383
|
+
# Add a horizontal page break after the given row index.
|
|
1384
|
+
#
|
|
1385
|
+
# @example
|
|
1386
|
+
# s.page_break_row(25)
|
|
1387
|
+
#
|
|
1388
|
+
# @param row_index [Integer] 0-based row index.
|
|
1389
|
+
# @return [void]
|
|
1027
1390
|
# @api public
|
|
1028
|
-
# : (
|
|
1029
|
-
def page_break_row: (
|
|
1030
|
-
|
|
1031
|
-
#
|
|
1032
|
-
#
|
|
1391
|
+
# : (Integer row_index) -> void
|
|
1392
|
+
def page_break_row: (Integer row_index) -> void
|
|
1393
|
+
|
|
1394
|
+
# simplecov:disable
|
|
1395
|
+
# Edge case / untested delegation block
|
|
1396
|
+
# Add a vertical page break after the given column index.
|
|
1397
|
+
#
|
|
1398
|
+
# @example
|
|
1399
|
+
# s.page_break_col(5)
|
|
1400
|
+
#
|
|
1401
|
+
# @param col_index [Integer] 0-based column index.
|
|
1402
|
+
# @return [void]
|
|
1033
1403
|
# @api public
|
|
1034
|
-
# : (
|
|
1035
|
-
def page_break_col: (
|
|
1404
|
+
# : (Integer col_index) -> void
|
|
1405
|
+
def page_break_col: (Integer col_index) -> void
|
|
1036
1406
|
end
|
|
1037
1407
|
|
|
1038
1408
|
# Add a new sheet.
|
|
@@ -1104,20 +1474,20 @@ module Xlsxrb
|
|
|
1104
1474
|
def conditional_format: (untyped sqref, **untyped opts) -> void
|
|
1105
1475
|
|
|
1106
1476
|
# --- Tables ---
|
|
1107
|
-
# : (untyped ref, **untyped opts) -> void
|
|
1108
|
-
def table: (untyped ref, **untyped opts) -> void
|
|
1477
|
+
# : (untyped ref, columns: untyped, ?name: untyped, ?display_name: untyped, ?style: untyped, **untyped opts) -> void
|
|
1478
|
+
def table: (untyped ref, columns: untyped, ?name: untyped, ?display_name: untyped, ?style: untyped, **untyped opts) -> void
|
|
1109
1479
|
|
|
1110
1480
|
# --- Pivot Tables ---
|
|
1111
|
-
# : (untyped source_ref, **untyped opts) -> void
|
|
1112
|
-
def pivot_table: (untyped source_ref, **untyped opts) -> void
|
|
1481
|
+
# : (untyped source_ref, row_fields: untyped, data_fields: untyped, ?col_fields: untyped, ?dest_ref: untyped, ?name: untyped, ?field_names: untyped, ?items: untyped, **untyped opts) -> void
|
|
1482
|
+
def pivot_table: (untyped source_ref, row_fields: untyped, data_fields: untyped, ?col_fields: untyped, ?dest_ref: untyped, ?name: untyped, ?field_names: untyped, ?items: untyped, **untyped opts) -> void
|
|
1113
1483
|
|
|
1114
1484
|
# --- Comments ---
|
|
1115
1485
|
# : (String | Integer cell, String text, ?author: ::String) -> void
|
|
1116
1486
|
def comment: (String | Integer cell, String text, ?author: ::String) -> void
|
|
1117
1487
|
|
|
1118
1488
|
# --- Sparklines ---
|
|
1119
|
-
# : (**untyped opts) -> void
|
|
1120
|
-
def sparkline_group: (**untyped opts) -> void
|
|
1489
|
+
# : (sparklines: untyped, ?type: untyped, **untyped opts) -> void
|
|
1490
|
+
def sparkline_group: (sparklines: untyped, ?type: untyped, **untyped opts) -> void
|
|
1121
1491
|
|
|
1122
1492
|
# Merge a range of cells (e.g. "A1:B2"), or by coordinate indices.
|
|
1123
1493
|
#
|