xlsxrb 0.1.7 → 0.1.8

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.
@@ -431,7 +431,7 @@ Demonstrates horizontal text alignment (left, center, right).
431
431
 
432
432
  require "xlsxrb"
433
433
  output_path = ARGV[0] || "align_horizontal.xlsx"
434
- Xlsxrb.generate(output_path) do |wb|
434
+ Xlsxrb.write(output_path) do |wb|
435
435
  wb.style("left") { |s| s.align_horizontal("left") }
436
436
  wb.style("center") { |s| s.align_horizontal("center") }
437
437
  wb.style("right") { |s| s.align_horizontal("right") }
@@ -446,7 +446,7 @@ end
446
446
 
447
447
  # 2. Read the generated sheet and print the parsed alignments
448
448
  puts "=== Read Alignment (Xlsxrb.read) ==="
449
- workbook = Xlsxrb.read(output_path)
449
+ workbook = Xlsxrb.read(output_path).load
450
450
  sheet = workbook.sheets.first
451
451
  row = sheet.rows.first
452
452
 
@@ -483,7 +483,7 @@ Demonstrates horizontal fill alignment (repeats value to fill cell width).
483
483
 
484
484
  require "xlsxrb"
485
485
  output_path = ARGV[0] || "align_horizontal_fill.xlsx"
486
- Xlsxrb.generate(output_path) do |wb|
486
+ Xlsxrb.write(output_path) do |wb|
487
487
  wb.style("fill_align") { |s| s.align_horizontal("fill") }
488
488
  wb.sheet("Alignment") do |s|
489
489
  s.column(0, width: 30)
@@ -493,7 +493,7 @@ end
493
493
 
494
494
  # 2. Read the generated sheet and print the parsed alignments
495
495
  puts "=== Read Validation ==="
496
- workbook = Xlsxrb.read(output_path)
496
+ workbook = Xlsxrb.read(output_path).load
497
497
  sheet = workbook.sheets.first
498
498
  row = sheet.rows.first
499
499
  row.cells.each do |c|
@@ -532,7 +532,7 @@ Demonstrates horizontal justify text alignment.
532
532
 
533
533
  require "xlsxrb"
534
534
  output_path = ARGV[0] || "align_horizontal_justify.xlsx"
535
- Xlsxrb.generate(output_path) do |wb|
535
+ Xlsxrb.write(output_path) do |wb|
536
536
  wb.style("justify_align") do |s|
537
537
  s.align_horizontal("justify")
538
538
  s.wrap_text(true)
@@ -545,7 +545,7 @@ end
545
545
 
546
546
  # 2. Read the generated sheet and print the parsed alignments
547
547
  puts "=== Read Validation ==="
548
- workbook = Xlsxrb.read(output_path)
548
+ workbook = Xlsxrb.read(output_path).load
549
549
  sheet = workbook.sheets.first
550
550
  row = sheet.rows.first
551
551
  row.cells.each do |c|
@@ -584,7 +584,7 @@ Demonstrates text indentation inside cells.
584
584
 
585
585
  require "xlsxrb"
586
586
  output_path = ARGV[0] || "align_indent.xlsx"
587
- Xlsxrb.generate(output_path) do |wb|
587
+ Xlsxrb.write(output_path) do |wb|
588
588
  wb.style("indent_1") { |s| s.align_horizontal("left").indent(1) }
589
589
  wb.style("indent_3") { |s| s.align_horizontal("left").indent(3) }
590
590
  wb.sheet("Indent") do |s|
@@ -599,7 +599,7 @@ end
599
599
 
600
600
  # 2. Read the generated sheet and print the parsed alignments
601
601
  puts "=== Read Validation ==="
602
- workbook = Xlsxrb.read(output_path)
602
+ workbook = Xlsxrb.read(output_path).load
603
603
  sheet = workbook.sheets.first
604
604
  row = sheet.rows.first
605
605
  row.cells.each do |c|
@@ -638,7 +638,7 @@ Demonstrates text rotated by specific angles (45, 90 degrees).
638
638
 
639
639
  require "xlsxrb"
640
640
  output_path = ARGV[0] || "align_text_rotation.xlsx"
641
- Xlsxrb.generate(output_path) do |wb|
641
+ Xlsxrb.write(output_path) do |wb|
642
642
  wb.style("rot_45") { |s| s.text_rotation(45) }
643
643
  wb.style("rot_90") { |s| s.text_rotation(90) }
644
644
  wb.sheet("Rotation") do |s|
@@ -651,7 +651,7 @@ end
651
651
 
652
652
  # 2. Read the generated sheet and print the parsed alignments
653
653
  puts "=== Read Validation ==="
654
- workbook = Xlsxrb.read(output_path)
654
+ workbook = Xlsxrb.read(output_path).load
655
655
  sheet = workbook.sheets.first
656
656
  row = sheet.rows.first
657
657
  row.cells.each do |c|
@@ -691,7 +691,7 @@ Demonstrates auto-wrapping multi-line text inside narrow cells.
691
691
 
692
692
  require "xlsxrb"
693
693
  output_path = ARGV[0] || "align_text_wrap.xlsx"
694
- Xlsxrb.generate(output_path) do |wb|
694
+ Xlsxrb.write(output_path) do |wb|
695
695
  wb.style("wrap", &:wrap_text)
696
696
  wb.sheet("Text Wrap") do |s|
697
697
  s.print_options(:grid_lines, true)
@@ -702,7 +702,7 @@ end
702
702
 
703
703
  # 2. Read the generated sheet and print the parsed alignments
704
704
  puts "=== Read Validation ==="
705
- workbook = Xlsxrb.read(output_path)
705
+ workbook = Xlsxrb.read(output_path).load
706
706
  sheet = workbook.sheets.first
707
707
  row = sheet.rows.first
708
708
  row.cells.each do |c|
@@ -741,7 +741,7 @@ Demonstrates vertical text alignment (top, center, bottom).
741
741
 
742
742
  require "xlsxrb"
743
743
  output_path = ARGV[0] || "align_vertical.xlsx"
744
- Xlsxrb.generate(output_path) do |wb|
744
+ Xlsxrb.write(output_path) do |wb|
745
745
  wb.style("top") { |s| s.align_vertical("top") }
746
746
  wb.style("center") { |s| s.align_vertical("center") }
747
747
  wb.style("bottom") { |s| s.align_vertical("bottom") }
@@ -755,7 +755,7 @@ end
755
755
 
756
756
  # 2. Read the generated sheet and print the parsed alignments
757
757
  puts "=== Read Validation ==="
758
- workbook = Xlsxrb.read(output_path)
758
+ workbook = Xlsxrb.read(output_path).load
759
759
  sheet = workbook.sheets.first
760
760
  row = sheet.rows.first
761
761
  row.cells.each do |c|
@@ -799,7 +799,7 @@ require "date"
799
799
 
800
800
  output_path = ARGV[0] || "basic_data.xlsx"
801
801
 
802
- Xlsxrb.generate(output_path) do |wb|
802
+ Xlsxrb.write(output_path) do |wb|
803
803
  wb.style("currency") { |style| style.number_format("$#,##0.00") }
804
804
  wb.style("date") { |style| style.number_format("yyyy-mm-dd") }
805
805
  wb.sheet("Basic Data") do |sheet|
@@ -815,7 +815,7 @@ end
815
815
 
816
816
  # 2. Read the generated sheet and print parsed cell values and Ruby classes
817
817
  puts "=== Read Validation ==="
818
- workbook = Xlsxrb.read(output_path)
818
+ workbook = Xlsxrb.read(output_path).load
819
819
  sheet = workbook.sheets.first
820
820
  sheet.rows.each do |row|
821
821
  row_cells = row.cells.map do |c|
@@ -853,7 +853,7 @@ require "xlsxrb"
853
853
 
854
854
  output_path = ARGV[0] || "borders.xlsx"
855
855
 
856
- Xlsxrb.generate(output_path) do |wb|
856
+ Xlsxrb.write(output_path) do |wb|
857
857
  wb.style("thin") { |s| s.border_all(style: "thin", color: "FF000000") }
858
858
  wb.style("medium") { |s| s.border_all(style: "medium", color: "FF000000") }
859
859
  wb.style("thick") { |s| s.border_all(style: "thick", color: "FF000000") }
@@ -892,7 +892,7 @@ end
892
892
 
893
893
  # Read check
894
894
  puts "=== Read Validation ==="
895
- workbook = Xlsxrb.read(output_path)
895
+ workbook = Xlsxrb.read(output_path).load
896
896
  sheet = workbook.sheets.first
897
897
  sheet.rows.each do |row|
898
898
  row_cells = row.cells.map do |c|
@@ -941,7 +941,7 @@ Demonstrates boolean values serialized and rendered.
941
941
 
942
942
  require "xlsxrb"
943
943
  output_path = ARGV[0] || "cell_booleans.xlsx"
944
- Xlsxrb.generate(output_path) do |wb|
944
+ Xlsxrb.write(output_path) do |wb|
945
945
  wb.sheet("Booleans") do |s|
946
946
  s.column(0, width: 25)
947
947
  s.column(1, width: 25)
@@ -953,7 +953,7 @@ end
953
953
 
954
954
  # 2. Read the generated sheet and print parsed cell values and Ruby classes
955
955
  puts "=== Read Validation ==="
956
- workbook = Xlsxrb.read(output_path)
956
+ workbook = Xlsxrb.read(output_path).load
957
957
  sheet = workbook.sheets.first
958
958
  sheet.rows.each do |row|
959
959
  row_cells = row.cells.map do |c|
@@ -990,7 +990,7 @@ Demonstrates dates serialized natively and formatted with standard or custom for
990
990
  require "xlsxrb"
991
991
  require "date"
992
992
  output_path = ARGV[0] || "cell_dates.xlsx"
993
- Xlsxrb.generate(output_path) do |wb|
993
+ Xlsxrb.write(output_path) do |wb|
994
994
  wb.style("custom_date") { |s| s.num_fmt("yyyy-mm-dd") }
995
995
  wb.sheet("Dates") do |s|
996
996
  s.column(0, width: 25)
@@ -1003,7 +1003,7 @@ end
1003
1003
 
1004
1004
  # 2. Read the generated sheet and print parsed cell values and Ruby classes
1005
1005
  puts "=== Read Validation ==="
1006
- workbook = Xlsxrb.read(output_path)
1006
+ workbook = Xlsxrb.read(output_path).load
1007
1007
  sheet = workbook.sheets.first
1008
1008
  sheet.rows.each do |row|
1009
1009
  row_cells = row.cells.map do |c|
@@ -1039,7 +1039,7 @@ Demonstrates standard spreadsheet calculations and formulas (SUM, AVERAGE).
1039
1039
 
1040
1040
  require "xlsxrb"
1041
1041
  output_path = ARGV[0] || "cell_formulas.xlsx"
1042
- Xlsxrb.generate(output_path) do |wb|
1042
+ Xlsxrb.write(output_path) do |wb|
1043
1043
  wb.sheet("Formulas") do |s|
1044
1044
  s.column(0, width: 25)
1045
1045
  s.column(1, width: 25)
@@ -1053,7 +1053,7 @@ end
1053
1053
 
1054
1054
  # 2. Read the generated sheet and print parsed cell values and Ruby classes
1055
1055
  puts "=== Read Validation ==="
1056
- workbook = Xlsxrb.read(output_path)
1056
+ workbook = Xlsxrb.read(output_path).load
1057
1057
  sheet = workbook.sheets.first
1058
1058
  sheet.rows.each do |row|
1059
1059
  row_cells = row.cells.map do |c|
@@ -1091,7 +1091,7 @@ Demonstrates Yen Currency format code formatting.
1091
1091
 
1092
1092
  require "xlsxrb"
1093
1093
  output_path = ARGV[0] || "cell_num_currency_jpy.xlsx"
1094
- Xlsxrb.generate(output_path) do |wb|
1094
+ Xlsxrb.write(output_path) do |wb|
1095
1095
  wb.style("jpy") { |s| s.num_fmt("¥#,##0;[Red]¥-#,##0") }
1096
1096
  wb.sheet("JPY Currency") do |s|
1097
1097
  s.column(0, width: 25)
@@ -1104,7 +1104,7 @@ end
1104
1104
 
1105
1105
  # 2. Read the generated sheet and print parsed cell numbers and format codes
1106
1106
  puts "=== Read Validation ==="
1107
- workbook = Xlsxrb.read(output_path)
1107
+ workbook = Xlsxrb.read(output_path).load
1108
1108
  sheet = workbook.sheets.first
1109
1109
  sheet.rows.each do |row|
1110
1110
  row_cells = row.cells.map do |c|
@@ -1142,7 +1142,7 @@ Demonstrates custom colored formats for positive and negative numbers.
1142
1142
 
1143
1143
  require "xlsxrb"
1144
1144
  output_path = ARGV[0] || "cell_num_custom_colors.xlsx"
1145
- Xlsxrb.generate(output_path) do |wb|
1145
+ Xlsxrb.write(output_path) do |wb|
1146
1146
  wb.style("custom_color") { |s| s.num_fmt("[Green]#,##0;[Red]-#,##0") }
1147
1147
  wb.sheet("Custom Colors") do |s|
1148
1148
  s.column(0, width: 25)
@@ -1155,7 +1155,7 @@ end
1155
1155
 
1156
1156
  # 2. Read the generated sheet and print parsed cell numbers and format codes
1157
1157
  puts "=== Read Validation ==="
1158
- workbook = Xlsxrb.read(output_path)
1158
+ workbook = Xlsxrb.read(output_path).load
1159
1159
  sheet = workbook.sheets.first
1160
1160
  sheet.rows.each do |row|
1161
1161
  row_cells = row.cells.map do |c|
@@ -1193,7 +1193,7 @@ Demonstrates fraction number formats (# ?/?).
1193
1193
 
1194
1194
  require "xlsxrb"
1195
1195
  output_path = ARGV[0] || "cell_num_fractions.xlsx"
1196
- Xlsxrb.generate(output_path) do |wb|
1196
+ Xlsxrb.write(output_path) do |wb|
1197
1197
  wb.style("frac") { |s| s.num_fmt("# ?/?") }
1198
1198
  wb.sheet("Fractions") do |s|
1199
1199
  s.column(0, width: 25)
@@ -1207,7 +1207,7 @@ end
1207
1207
 
1208
1208
  # 2. Read the generated sheet and print parsed cell numbers and format codes
1209
1209
  puts "=== Read Validation ==="
1210
- workbook = Xlsxrb.read(output_path)
1210
+ workbook = Xlsxrb.read(output_path).load
1211
1211
  sheet = workbook.sheets.first
1212
1212
  sheet.rows.each do |row|
1213
1213
  row_cells = row.cells.map do |c|
@@ -1246,7 +1246,7 @@ Demonstrates percentages with two decimal places (0.00%).
1246
1246
 
1247
1247
  require "xlsxrb"
1248
1248
  output_path = ARGV[0] || "cell_num_percent_decimals.xlsx"
1249
- Xlsxrb.generate(output_path) do |wb|
1249
+ Xlsxrb.write(output_path) do |wb|
1250
1250
  wb.style("pct2") { |s| s.num_fmt("0.00%") }
1251
1251
  wb.sheet("Percents") do |s|
1252
1252
  s.column(0, width: 25)
@@ -1258,7 +1258,7 @@ end
1258
1258
 
1259
1259
  # 2. Read the generated sheet and print parsed cell numbers and format codes
1260
1260
  puts "=== Read Validation ==="
1261
- workbook = Xlsxrb.read(output_path)
1261
+ workbook = Xlsxrb.read(output_path).load
1262
1262
  sheet = workbook.sheets.first
1263
1263
  sheet.rows.each do |row|
1264
1264
  row_cells = row.cells.map do |c|
@@ -1295,7 +1295,7 @@ Demonstrates scientific number formats (0.00E+00).
1295
1295
 
1296
1296
  require "xlsxrb"
1297
1297
  output_path = ARGV[0] || "cell_num_scientific.xlsx"
1298
- Xlsxrb.generate(output_path) do |wb|
1298
+ Xlsxrb.write(output_path) do |wb|
1299
1299
  wb.style("sci") { |s| s.num_fmt("0.00E+00") }
1300
1300
  wb.sheet("Scientific") do |s|
1301
1301
  s.column(0, width: 25)
@@ -1308,7 +1308,7 @@ end
1308
1308
 
1309
1309
  # 2. Read the generated sheet and print parsed cell numbers and format codes
1310
1310
  puts "=== Read Validation ==="
1311
- workbook = Xlsxrb.read(output_path)
1311
+ workbook = Xlsxrb.read(output_path).load
1312
1312
  sheet = workbook.sheets.first
1313
1313
  sheet.rows.each do |row|
1314
1314
  row_cells = row.cells.map do |c|
@@ -1346,7 +1346,7 @@ Demonstrates custom formatting for integers, floating point numbers, currencies,
1346
1346
 
1347
1347
  require "xlsxrb"
1348
1348
  output_path = ARGV[0] || "cell_numbers.xlsx"
1349
- Xlsxrb.generate(output_path) do |wb|
1349
+ Xlsxrb.write(output_path) do |wb|
1350
1350
  wb.style("currency") { |s| s.num_fmt("$#,##0.00") }
1351
1351
  wb.style("percent") { |s| s.num_fmt("0.0%") }
1352
1352
  wb.sheet("Numbers") do |s|
@@ -1362,7 +1362,7 @@ end
1362
1362
 
1363
1363
  # 2. Read the generated sheet and print parsed cell values and Ruby classes
1364
1364
  puts "=== Read Validation ==="
1365
- workbook = Xlsxrb.read(output_path)
1365
+ workbook = Xlsxrb.read(output_path).load
1366
1366
  sheet = workbook.sheets.first
1367
1367
  sheet.rows.each do |row|
1368
1368
  row_cells = row.cells.map do |c|
@@ -1400,7 +1400,7 @@ Demonstrates Rich Text cells with multiple font weights, styles, and colors in a
1400
1400
 
1401
1401
  require "xlsxrb"
1402
1402
  output_path = ARGV[0] || "cell_rich_text.xlsx"
1403
- Xlsxrb.generate(output_path) do |wb|
1403
+ Xlsxrb.write(output_path) do |wb|
1404
1404
  rt = Xlsxrb.rich_text(
1405
1405
  { text: "Normal " },
1406
1406
  { text: "BOLD RED ", font: { bold: true, color: "FFC00000", sz: 16 } },
@@ -1416,7 +1416,7 @@ end
1416
1416
 
1417
1417
  # 2. Read the generated sheet and print parsed cell values and Ruby classes
1418
1418
  puts "=== Read Validation ==="
1419
- workbook = Xlsxrb.read(output_path)
1419
+ workbook = Xlsxrb.read(output_path).load
1420
1420
  sheet = workbook.sheets.first
1421
1421
  sheet.rows.each do |row|
1422
1422
  row_cells = row.cells.map do |c|
@@ -1452,7 +1452,7 @@ Demonstrates timestamp values serialized natively and formatted showing hours, m
1452
1452
  require "xlsxrb"
1453
1453
  require "time"
1454
1454
  output_path = ARGV[0] || "cell_times.xlsx"
1455
- Xlsxrb.generate(output_path) do |wb|
1455
+ Xlsxrb.write(output_path) do |wb|
1456
1456
  wb.style("time_fmt") { |s| s.num_fmt("hh:mm:ss") }
1457
1457
  wb.sheet("Times") do |s|
1458
1458
  s.column(0, width: 25)
@@ -1465,7 +1465,7 @@ end
1465
1465
 
1466
1466
  # 2. Read the generated sheet and print parsed cell values and Ruby classes
1467
1467
  puts "=== Read Validation ==="
1468
- workbook = Xlsxrb.read(output_path)
1468
+ workbook = Xlsxrb.read(output_path).load
1469
1469
  sheet = workbook.sheets.first
1470
1470
  sheet.rows.each do |row|
1471
1471
  row_cells = row.cells.map do |c|
@@ -1501,7 +1501,7 @@ Demonstrates conditional formatting highlighting cells starting with specific te
1501
1501
 
1502
1502
  require "xlsxrb"
1503
1503
  output_path = ARGV[0] || "cf_begins_with.xlsx"
1504
- Xlsxrb.generate(output_path) do |wb|
1504
+ Xlsxrb.write(output_path) do |wb|
1505
1505
  wb.sheet("CF Begins") do |s|
1506
1506
  s.column(0, width: 25)
1507
1507
  s.column(1, width: 25)
@@ -1515,7 +1515,7 @@ end
1515
1515
 
1516
1516
  # 2. Read the generated sheet and print cell values
1517
1517
  puts "=== Read Validation ==="
1518
- workbook = Xlsxrb.read(output_path)
1518
+ workbook = Xlsxrb.read(output_path).load
1519
1519
  sheet = workbook.sheets.first
1520
1520
  sheet.rows.first(5).each do |row|
1521
1521
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -1550,7 +1550,7 @@ Demonstrates conditional formatting highlighting cells within a range.
1550
1550
 
1551
1551
  require "xlsxrb"
1552
1552
  output_path = ARGV[0] || "cf_cell_between.xlsx"
1553
- Xlsxrb.generate(output_path) do |wb|
1553
+ Xlsxrb.write(output_path) do |wb|
1554
1554
  wb.style("center") { |style| style.align_horizontal("center") }
1555
1555
  wb.sheet("CF Between") do |s|
1556
1556
  s.column(0, width: 25)
@@ -1565,7 +1565,7 @@ end
1565
1565
 
1566
1566
  # 2. Read the generated sheet and print cell values
1567
1567
  puts "=== Read Validation ==="
1568
- workbook = Xlsxrb.read(output_path)
1568
+ workbook = Xlsxrb.read(output_path).load
1569
1569
  sheet = workbook.sheets.first
1570
1570
  sheet.rows.first(5).each do |row|
1571
1571
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -1600,7 +1600,7 @@ Demonstrates conditional formatting highlighting cells equal to a target value.
1600
1600
 
1601
1601
  require "xlsxrb"
1602
1602
  output_path = ARGV[0] || "cf_cell_equal_to.xlsx"
1603
- Xlsxrb.generate(output_path) do |wb|
1603
+ Xlsxrb.write(output_path) do |wb|
1604
1604
  wb.style("center") { |style| style.align_horizontal("center") }
1605
1605
  wb.sheet("CF Equal") do |s|
1606
1606
  s.column(0, width: 25)
@@ -1615,7 +1615,7 @@ end
1615
1615
 
1616
1616
  # 2. Read the generated sheet and print cell values
1617
1617
  puts "=== Read Validation ==="
1618
- workbook = Xlsxrb.read(output_path)
1618
+ workbook = Xlsxrb.read(output_path).load
1619
1619
  sheet = workbook.sheets.first
1620
1620
  sheet.rows.first(5).each do |row|
1621
1621
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -1650,7 +1650,7 @@ Demonstrates conditional formatting highlighting cells greater than or equal to
1650
1650
 
1651
1651
  require "xlsxrb"
1652
1652
  output_path = ARGV[0] || "cf_cell_greater_equal.xlsx"
1653
- Xlsxrb.generate(output_path) do |wb|
1653
+ Xlsxrb.write(output_path) do |wb|
1654
1654
  wb.style("center") { |style| style.align_horizontal("center") }
1655
1655
  wb.sheet("CF Greater Equal") do |s|
1656
1656
  s.column(0, width: 25)
@@ -1665,7 +1665,7 @@ end
1665
1665
 
1666
1666
  # 2. Read the generated sheet and print cell values
1667
1667
  puts "=== Read Validation ==="
1668
- workbook = Xlsxrb.read(output_path)
1668
+ workbook = Xlsxrb.read(output_path).load
1669
1669
  sheet = workbook.sheets.first
1670
1670
  sheet.rows.first(5).each do |row|
1671
1671
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -1700,7 +1700,7 @@ Demonstrates conditional formatting highlighting cells greater than a threshold.
1700
1700
 
1701
1701
  require "xlsxrb"
1702
1702
  output_path = ARGV[0] || "cf_cell_greater_than.xlsx"
1703
- Xlsxrb.generate(output_path) do |wb|
1703
+ Xlsxrb.write(output_path) do |wb|
1704
1704
  wb.style("center") { |style| style.align_horizontal("center") }
1705
1705
  wb.sheet("CF Greater") do |s|
1706
1706
  s.column(0, width: 25)
@@ -1715,7 +1715,7 @@ end
1715
1715
 
1716
1716
  # 2. Read the generated sheet and print cell values
1717
1717
  puts "=== Read Validation ==="
1718
- workbook = Xlsxrb.read(output_path)
1718
+ workbook = Xlsxrb.read(output_path).load
1719
1719
  sheet = workbook.sheets.first
1720
1720
  sheet.rows.first(5).each do |row|
1721
1721
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -1750,7 +1750,7 @@ Demonstrates conditional formatting highlighting cells less than a threshold.
1750
1750
 
1751
1751
  require "xlsxrb"
1752
1752
  output_path = ARGV[0] || "cf_cell_less_than.xlsx"
1753
- Xlsxrb.generate(output_path) do |wb|
1753
+ Xlsxrb.write(output_path) do |wb|
1754
1754
  wb.style("center") { |style| style.align_horizontal("center") }
1755
1755
  wb.sheet("CF Less") do |s|
1756
1756
  s.column(0, width: 25)
@@ -1765,7 +1765,7 @@ end
1765
1765
 
1766
1766
  # 2. Read the generated sheet and print cell values
1767
1767
  puts "=== Read Validation ==="
1768
- workbook = Xlsxrb.read(output_path)
1768
+ workbook = Xlsxrb.read(output_path).load
1769
1769
  sheet = workbook.sheets.first
1770
1770
  sheet.rows.first(5).each do |row|
1771
1771
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -1800,7 +1800,7 @@ Demonstrates color scale/heatmap conditional formatting.
1800
1800
 
1801
1801
  require "xlsxrb"
1802
1802
  output_path = ARGV[0] || "cf_color_scale.xlsx"
1803
- Xlsxrb.generate(output_path) do |wb|
1803
+ Xlsxrb.write(output_path) do |wb|
1804
1804
  wb.style("center") { |style| style.align_horizontal("center") }
1805
1805
  wb.sheet("Colors") do |s|
1806
1806
  s.column(0, width: 25)
@@ -1814,7 +1814,7 @@ end
1814
1814
 
1815
1815
  # 2. Read the generated sheet and print cell values
1816
1816
  puts "=== Read Validation ==="
1817
- workbook = Xlsxrb.read(output_path)
1817
+ workbook = Xlsxrb.read(output_path).load
1818
1818
  sheet = workbook.sheets.first
1819
1819
  sheet.rows.first(5).each do |row|
1820
1820
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -1848,7 +1848,7 @@ Demonstrates conditional formatting highlighting cells containing specific text.
1848
1848
 
1849
1849
  require "xlsxrb"
1850
1850
  output_path = ARGV[0] || "cf_contains_text.xlsx"
1851
- Xlsxrb.generate(output_path) do |wb|
1851
+ Xlsxrb.write(output_path) do |wb|
1852
1852
  wb.sheet("CF Contains") do |s|
1853
1853
  s.column(0, width: 25)
1854
1854
  s.column(1, width: 25)
@@ -1862,7 +1862,7 @@ end
1862
1862
 
1863
1863
  # 2. Read the generated sheet and print cell values
1864
1864
  puts "=== Read Validation ==="
1865
- workbook = Xlsxrb.read(output_path)
1865
+ workbook = Xlsxrb.read(output_path).load
1866
1866
  sheet = workbook.sheets.first
1867
1867
  sheet.rows.first(5).each do |row|
1868
1868
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -1897,7 +1897,7 @@ Demonstrates data bar visual conditional formatting indicators.
1897
1897
 
1898
1898
  require "xlsxrb"
1899
1899
  output_path = ARGV[0] || "cf_data_bar.xlsx"
1900
- Xlsxrb.generate(output_path) do |wb|
1900
+ Xlsxrb.write(output_path) do |wb|
1901
1901
  wb.style("center") { |style| style.align_horizontal("center") }
1902
1902
  wb.sheet("Data Bars") do |s|
1903
1903
  s.column(0, width: 25)
@@ -1911,7 +1911,7 @@ end
1911
1911
 
1912
1912
  # 2. Read the generated sheet and print cell values
1913
1913
  puts "=== Read Validation ==="
1914
- workbook = Xlsxrb.read(output_path)
1914
+ workbook = Xlsxrb.read(output_path).load
1915
1915
  sheet = workbook.sheets.first
1916
1916
  sheet.rows.first(5).each do |row|
1917
1917
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -1945,7 +1945,7 @@ Demonstrates conditional formatting highlighting cells ending with specific text
1945
1945
 
1946
1946
  require "xlsxrb"
1947
1947
  output_path = ARGV[0] || "cf_ends_with.xlsx"
1948
- Xlsxrb.generate(output_path) do |wb|
1948
+ Xlsxrb.write(output_path) do |wb|
1949
1949
  wb.sheet("CF Ends") do |s|
1950
1950
  s.column(0, width: 25)
1951
1951
  s.column(1, width: 25)
@@ -1959,7 +1959,7 @@ end
1959
1959
 
1960
1960
  # 2. Read the generated sheet and print cell values
1961
1961
  puts "=== Read Validation ==="
1962
- workbook = Xlsxrb.read(output_path)
1962
+ workbook = Xlsxrb.read(output_path).load
1963
1963
  sheet = workbook.sheets.first
1964
1964
  sheet.rows.first(5).each do |row|
1965
1965
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -1994,7 +1994,7 @@ Demonstrates conditional formatting using a custom formula expression.
1994
1994
 
1995
1995
  require "xlsxrb"
1996
1996
  output_path = ARGV[0] || "cf_expression_formula.xlsx"
1997
- Xlsxrb.generate(output_path) do |wb|
1997
+ Xlsxrb.write(output_path) do |wb|
1998
1998
  wb.style("center") { |style| style.align_horizontal("center") }
1999
1999
  wb.sheet("CF Expression") do |s|
2000
2000
  s.column(0, width: 25)
@@ -2010,7 +2010,7 @@ end
2010
2010
 
2011
2011
  # 2. Read the generated sheet and print cell values
2012
2012
  puts "=== Read Validation ==="
2013
- workbook = Xlsxrb.read(output_path)
2013
+ workbook = Xlsxrb.read(output_path).load
2014
2014
  sheet = workbook.sheets.first
2015
2015
  sheet.rows.first(5).each do |row|
2016
2016
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -2046,7 +2046,7 @@ Demonstrates icon set indicators (red/yellow/green arrows).
2046
2046
 
2047
2047
  require "xlsxrb"
2048
2048
  output_path = ARGV[0] || "cf_icon_set.xlsx"
2049
- Xlsxrb.generate(output_path) do |wb|
2049
+ Xlsxrb.write(output_path) do |wb|
2050
2050
  wb.style("center") { |style| style.align_horizontal("center") }
2051
2051
  wb.sheet("Icons") do |s|
2052
2052
  s.column(0, width: 25)
@@ -2060,7 +2060,7 @@ end
2060
2060
 
2061
2061
  # 2. Read the generated sheet and print cell values
2062
2062
  puts "=== Read Validation ==="
2063
- workbook = Xlsxrb.read(output_path)
2063
+ workbook = Xlsxrb.read(output_path).load
2064
2064
  sheet = workbook.sheets.first
2065
2065
  sheet.rows.first(5).each do |row|
2066
2066
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -2094,7 +2094,7 @@ Demonstrates embedding a standard 2D Area Chart.
2094
2094
 
2095
2095
  require "xlsxrb"
2096
2096
  output_path = ARGV[0] || "chart_area.xlsx"
2097
- Xlsxrb.generate(output_path) do |wb|
2097
+ Xlsxrb.write(output_path) do |wb|
2098
2098
  wb.sheet("Data") do |s|
2099
2099
  s.sheet_properties(:fit_to_page, true)
2100
2100
  s.page_setup(fit_to_width: 1, fit_to_height: 1)
@@ -2114,7 +2114,7 @@ end
2114
2114
 
2115
2115
  # 2. Read the generated sheet and print the chart count
2116
2116
  puts "=== Read Validation ==="
2117
- workbook = Xlsxrb.read(output_path)
2117
+ workbook = Xlsxrb.read(output_path).load
2118
2118
  sheet = workbook.sheets.first
2119
2119
  puts "Sheet '#{sheet.name}' has #{sheet.charts.size} chart(s)"
2120
2120
  ```
@@ -2143,7 +2143,7 @@ Demonstrates embedding a stacked 2D Area Chart.
2143
2143
 
2144
2144
  require "xlsxrb"
2145
2145
  output_path = ARGV[0] || "chart_area_stacked.xlsx"
2146
- Xlsxrb.generate(output_path) do |wb|
2146
+ Xlsxrb.write(output_path) do |wb|
2147
2147
  wb.sheet("Data") do |s|
2148
2148
  s.column(0, width: 25)
2149
2149
  s.column(1, width: 25)
@@ -2168,7 +2168,7 @@ end
2168
2168
 
2169
2169
  # 2. Read the generated sheet and print the chart count
2170
2170
  puts "=== Read Validation ==="
2171
- workbook = Xlsxrb.read(output_path)
2171
+ workbook = Xlsxrb.read(output_path).load
2172
2172
  sheet = workbook.sheets.first
2173
2173
  puts "Sheet '#{sheet.name}' has #{sheet.charts.size} chart(s)"
2174
2174
  ```
@@ -2199,7 +2199,7 @@ require "xlsxrb"
2199
2199
 
2200
2200
  output_path = ARGV[0] || "chart_bar.xlsx"
2201
2201
 
2202
- Xlsxrb.generate(output_path) do |wb|
2202
+ Xlsxrb.write(output_path) do |wb|
2203
2203
  wb.sheet("Sales Data") do |s|
2204
2204
  s.sheet_properties(:fit_to_page, true)
2205
2205
  s.page_setup(fit_to_width: 1, fit_to_height: 1)
@@ -2225,7 +2225,7 @@ end
2225
2225
 
2226
2226
  # 2. Read the generated sheet and print the chart count
2227
2227
  puts "=== Read Validation ==="
2228
- workbook = Xlsxrb.read(output_path)
2228
+ workbook = Xlsxrb.read(output_path).load
2229
2229
  sheet = workbook.sheets.first
2230
2230
  puts "Sheet '#{sheet.name}' has #{sheet.charts.size} chart(s)"
2231
2231
  ```
@@ -2254,7 +2254,7 @@ Demonstrates embedding a 100% stacked 2D Bar Chart.
2254
2254
 
2255
2255
  require "xlsxrb"
2256
2256
  output_path = ARGV[0] || "chart_bar_percent_stacked.xlsx"
2257
- Xlsxrb.generate(output_path) do |wb|
2257
+ Xlsxrb.write(output_path) do |wb|
2258
2258
  wb.sheet("Data") do |s|
2259
2259
  s.column(0, width: 25)
2260
2260
  s.column(1, width: 25)
@@ -2279,7 +2279,7 @@ end
2279
2279
 
2280
2280
  # 2. Read the generated sheet and print the chart count
2281
2281
  puts "=== Read Validation ==="
2282
- workbook = Xlsxrb.read(output_path)
2282
+ workbook = Xlsxrb.read(output_path).load
2283
2283
  sheet = workbook.sheets.first
2284
2284
  puts "Sheet '#{sheet.name}' has #{sheet.charts.size} chart(s)"
2285
2285
  ```
@@ -2308,7 +2308,7 @@ Demonstrates embedding a stacked 2D Bar Chart.
2308
2308
 
2309
2309
  require "xlsxrb"
2310
2310
  output_path = ARGV[0] || "chart_bar_stacked.xlsx"
2311
- Xlsxrb.generate(output_path) do |wb|
2311
+ Xlsxrb.write(output_path) do |wb|
2312
2312
  wb.sheet("Data") do |s|
2313
2313
  s.column(0, width: 25)
2314
2314
  s.column(1, width: 25)
@@ -2333,7 +2333,7 @@ end
2333
2333
 
2334
2334
  # 2. Read the generated sheet and print the chart count
2335
2335
  puts "=== Read Validation ==="
2336
- workbook = Xlsxrb.read(output_path)
2336
+ workbook = Xlsxrb.read(output_path).load
2337
2337
  sheet = workbook.sheets.first
2338
2338
  puts "Sheet '#{sheet.name}' has #{sheet.charts.size} chart(s)"
2339
2339
  ```
@@ -2362,7 +2362,7 @@ Demonstrates embedding a standard 2D Doughnut Chart.
2362
2362
 
2363
2363
  require "xlsxrb"
2364
2364
  output_path = ARGV[0] || "chart_doughnut.xlsx"
2365
- Xlsxrb.generate(output_path) do |wb|
2365
+ Xlsxrb.write(output_path) do |wb|
2366
2366
  wb.sheet("Data") do |s|
2367
2367
  s.sheet_properties(:fit_to_page, true)
2368
2368
  s.page_setup(fit_to_width: 1, fit_to_height: 1)
@@ -2389,7 +2389,7 @@ end
2389
2389
 
2390
2390
  # 2. Read the generated sheet and print the chart count
2391
2391
  puts "=== Read Validation ==="
2392
- workbook = Xlsxrb.read(output_path)
2392
+ workbook = Xlsxrb.read(output_path).load
2393
2393
  sheet = workbook.sheets.first
2394
2394
  puts "Sheet '#{sheet.name}' has #{sheet.charts.size} chart(s)"
2395
2395
  ```
@@ -2418,7 +2418,7 @@ Demonstrates embedding a standard 2D Line Chart.
2418
2418
 
2419
2419
  require "xlsxrb"
2420
2420
  output_path = ARGV[0] || "chart_line.xlsx"
2421
- Xlsxrb.generate(output_path) do |wb|
2421
+ Xlsxrb.write(output_path) do |wb|
2422
2422
  wb.sheet("Data") do |s|
2423
2423
  s.sheet_properties(:fit_to_page, true)
2424
2424
  s.page_setup(fit_to_width: 1, fit_to_height: 1)
@@ -2439,7 +2439,7 @@ end
2439
2439
 
2440
2440
  # 2. Read the generated sheet and print the chart count
2441
2441
  puts "=== Read Validation ==="
2442
- workbook = Xlsxrb.read(output_path)
2442
+ workbook = Xlsxrb.read(output_path).load
2443
2443
  sheet = workbook.sheets.first
2444
2444
  puts "Sheet '#{sheet.name}' has #{sheet.charts.size} chart(s)"
2445
2445
  ```
@@ -2468,7 +2468,7 @@ Demonstrates embedding a stacked 2D Line Chart.
2468
2468
 
2469
2469
  require "xlsxrb"
2470
2470
  output_path = ARGV[0] || "chart_line_stacked.xlsx"
2471
- Xlsxrb.generate(output_path) do |wb|
2471
+ Xlsxrb.write(output_path) do |wb|
2472
2472
  wb.sheet("Data") do |s|
2473
2473
  s.column(0, width: 25)
2474
2474
  s.column(1, width: 25)
@@ -2493,7 +2493,7 @@ end
2493
2493
 
2494
2494
  # 2. Read the generated sheet and print the chart count
2495
2495
  puts "=== Read Validation ==="
2496
- workbook = Xlsxrb.read(output_path)
2496
+ workbook = Xlsxrb.read(output_path).load
2497
2497
  sheet = workbook.sheets.first
2498
2498
  puts "Sheet '#{sheet.name}' has #{sheet.charts.size} chart(s)"
2499
2499
  ```
@@ -2522,7 +2522,7 @@ Demonstrates embedding a standard 2D Pie Chart.
2522
2522
 
2523
2523
  require "xlsxrb"
2524
2524
  output_path = ARGV[0] || "chart_pie.xlsx"
2525
- Xlsxrb.generate(output_path) do |wb|
2525
+ Xlsxrb.write(output_path) do |wb|
2526
2526
  wb.sheet("Data") do |s|
2527
2527
  s.sheet_properties(:fit_to_page, true)
2528
2528
  s.page_setup(fit_to_width: 1, fit_to_height: 1)
@@ -2549,7 +2549,7 @@ end
2549
2549
 
2550
2550
  # 2. Read the generated sheet and print the chart count
2551
2551
  puts "=== Read Validation ==="
2552
- workbook = Xlsxrb.read(output_path)
2552
+ workbook = Xlsxrb.read(output_path).load
2553
2553
  sheet = workbook.sheets.first
2554
2554
  puts "Sheet '#{sheet.name}' has #{sheet.charts.size} chart(s)"
2555
2555
  ```
@@ -2578,7 +2578,7 @@ Demonstrates embedding a standard 2D Radar Chart.
2578
2578
 
2579
2579
  require "xlsxrb"
2580
2580
  output_path = ARGV[0] || "chart_radar.xlsx"
2581
- Xlsxrb.generate(output_path) do |wb|
2581
+ Xlsxrb.write(output_path) do |wb|
2582
2582
  wb.sheet("Data") do |s|
2583
2583
  s.sheet_properties(:fit_to_page, true)
2584
2584
  s.page_setup(fit_to_width: 1, fit_to_height: 1)
@@ -2598,7 +2598,7 @@ end
2598
2598
 
2599
2599
  # 2. Read the generated sheet and print the chart count
2600
2600
  puts "=== Read Validation ==="
2601
- workbook = Xlsxrb.read(output_path)
2601
+ workbook = Xlsxrb.read(output_path).load
2602
2602
  sheet = workbook.sheets.first
2603
2603
  puts "Sheet '#{sheet.name}' has #{sheet.charts.size} chart(s)"
2604
2604
  ```
@@ -2627,7 +2627,7 @@ Demonstrates embedding a standard 2D Scatter Plot.
2627
2627
 
2628
2628
  require "xlsxrb"
2629
2629
  output_path = ARGV[0] || "chart_scatter.xlsx"
2630
- Xlsxrb.generate(output_path) do |wb|
2630
+ Xlsxrb.write(output_path) do |wb|
2631
2631
  wb.sheet("Data") do |s|
2632
2632
  s.sheet_properties(:fit_to_page, true)
2633
2633
  s.page_setup(fit_to_width: 1, fit_to_height: 1)
@@ -2647,7 +2647,7 @@ end
2647
2647
 
2648
2648
  # 2. Read the generated sheet and print the chart count
2649
2649
  puts "=== Read Validation ==="
2650
- workbook = Xlsxrb.read(output_path)
2650
+ workbook = Xlsxrb.read(output_path).load
2651
2651
  sheet = workbook.sheets.first
2652
2652
  puts "Sheet '#{sheet.name}' has #{sheet.charts.size} chart(s)"
2653
2653
  ```
@@ -2676,7 +2676,7 @@ Demonstrates outline grouping for columns.
2676
2676
 
2677
2677
  require "xlsxrb"
2678
2678
  output_path = ARGV[0] || "col_grouping.xlsx"
2679
- Xlsxrb.generate(output_path) do |wb|
2679
+ Xlsxrb.write(output_path) do |wb|
2680
2680
  wb.style("border") { |style| style.border_all(style: "thin", color: "FF000000") }
2681
2681
  wb.sheet("Col Grouping") do |s|
2682
2682
  s.sheet_properties(:fit_to_page, true)
@@ -2690,7 +2690,7 @@ end
2690
2690
 
2691
2691
  # 2. Read the generated sheet and print column dimensions
2692
2692
  puts "=== Read Validation ==="
2693
- workbook = Xlsxrb.read(output_path)
2693
+ workbook = Xlsxrb.read(output_path).load
2694
2694
  sheet = workbook.sheets.first
2695
2695
  sheet.columns.each do |col|
2696
2696
  puts "Column #{col.index}: width=#{col.width}, hidden=#{col.hidden}, outline_level=#{col.outline_level}"
@@ -2723,7 +2723,7 @@ Demonstrates setting very wide column widths.
2723
2723
 
2724
2724
  require "xlsxrb"
2725
2725
  output_path = ARGV[0] || "col_width_tall.xlsx"
2726
- Xlsxrb.generate(output_path) do |wb|
2726
+ Xlsxrb.write(output_path) do |wb|
2727
2727
  wb.style("border") { |style| style.border_all(style: "thin", color: "FF000000") }
2728
2728
  wb.sheet("Col Width") do |s|
2729
2729
  s.column(0, width: 50)
@@ -2734,7 +2734,7 @@ end
2734
2734
 
2735
2735
  # 2. Read the generated sheet and print column dimensions
2736
2736
  puts "=== Read Validation ==="
2737
- workbook = Xlsxrb.read(output_path)
2737
+ workbook = Xlsxrb.read(output_path).load
2738
2738
  sheet = workbook.sheets.first
2739
2739
  sheet.columns.each do |col|
2740
2740
  puts "Column #{col.index}: width=#{col.width}, hidden=#{col.hidden}, outline_level=#{col.outline_level}"
@@ -2766,7 +2766,7 @@ Demonstrates setting custom column widths.
2766
2766
 
2767
2767
  require "xlsxrb"
2768
2768
  output_path = ARGV[0] || "col_widths.xlsx"
2769
- Xlsxrb.generate(output_path) do |wb|
2769
+ Xlsxrb.write(output_path) do |wb|
2770
2770
  wb.style("border") { |style| style.border_all(style: "thin", color: "FF000000") }
2771
2771
  wb.sheet("Widths") do |s|
2772
2772
  s.column(0, width: 30)
@@ -2777,7 +2777,7 @@ end
2777
2777
 
2778
2778
  # 2. Read the generated sheet and print column dimensions
2779
2779
  puts "=== Read Validation ==="
2780
- workbook = Xlsxrb.read(output_path)
2780
+ workbook = Xlsxrb.read(output_path).load
2781
2781
  sheet = workbook.sheets.first
2782
2782
  sheet.columns.each do |col|
2783
2783
  puts "Column #{col.index}: width=#{col.width}, hidden=#{col.hidden}, outline_level=#{col.outline_level}"
@@ -2811,7 +2811,7 @@ require "xlsxrb"
2811
2811
 
2812
2812
  output_path = ARGV[0] || "conditional_formatting.xlsx"
2813
2813
 
2814
- Xlsxrb.generate(output_path) do |wb|
2814
+ Xlsxrb.write(output_path) do |wb|
2815
2815
  wb.style("center") { |style| style.align_horizontal("center") }
2816
2816
  wb.sheet("Scores") do |s|
2817
2817
  s.column(0, width: 25)
@@ -2827,7 +2827,7 @@ end
2827
2827
 
2828
2828
  # 2. Read the generated sheet and print cell values
2829
2829
  puts "=== Read Validation ==="
2830
- workbook = Xlsxrb.read(output_path)
2830
+ workbook = Xlsxrb.read(output_path).load
2831
2831
  sheet = workbook.sheets.first
2832
2832
  sheet.rows.first(5).each do |row|
2833
2833
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -2881,7 +2881,7 @@ end
2881
2881
 
2882
2882
  dummy_png = make_png(100, 100, 255, 0, 0)
2883
2883
 
2884
- Xlsxrb.generate(output_path) do |wb|
2884
+ Xlsxrb.write(output_path) do |wb|
2885
2885
  wb.style("center") { |st| st.align_horizontal(:center) }
2886
2886
  wb.sheet("Images") do |s|
2887
2887
  s.row(["Logo Target cell:", "", "", "Boundary"], styles: %w[left center center center])
@@ -2900,7 +2900,7 @@ end
2900
2900
  # 2. Read the generated sheet and print cell values + parsed embedded images details
2901
2901
  puts "=== Read Validation ==="
2902
2902
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
2903
- workbook = Xlsxrb.read(output_path)
2903
+ workbook = Xlsxrb.read(output_path).load
2904
2904
  sheet = workbook.sheets.first
2905
2905
  sheet.rows.first(5).each do |row|
2906
2906
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -2944,7 +2944,7 @@ Demonstrates linear gradients inside cell backgrounds.
2944
2944
 
2945
2945
  require "xlsxrb"
2946
2946
  output_path = ARGV[0] || "fill_gradients.xlsx"
2947
- Xlsxrb.generate(output_path) do |wb|
2947
+ Xlsxrb.write(output_path) do |wb|
2948
2948
  wb.style("gradient") do |style|
2949
2949
  style.fill_gradient(type: "linear", degree: 45, stops: [
2950
2950
  { position: 0, color: "FFFFFFFF" },
@@ -2960,7 +2960,7 @@ end
2960
2960
 
2961
2961
  # 2. Read the generated sheet and print cell fill properties
2962
2962
  puts "=== Read Validation ==="
2963
- workbook = Xlsxrb.read(output_path)
2963
+ workbook = Xlsxrb.read(output_path).load
2964
2964
  sheet = workbook.sheets.first
2965
2965
  row = sheet.rows.first
2966
2966
  row.cells.each do |c|
@@ -2995,7 +2995,7 @@ Demonstrates standard pattern fills (darkGray, darkGrid) in cell backgrounds.
2995
2995
 
2996
2996
  require "xlsxrb"
2997
2997
  output_path = ARGV[0] || "fill_patterns.xlsx"
2998
- Xlsxrb.generate(output_path) do |wb|
2998
+ Xlsxrb.write(output_path) do |wb|
2999
2999
  wb.style("dark_gray") { |s| s.fill(pattern: "darkGray", fg_color: "FFC0C0C0", bg_color: "FFFFFFFF") }
3000
3000
  wb.style("grid_fill") { |s| s.fill(pattern: "darkGrid", fg_color: "FFC0C0C0", bg_color: "FFFFFFFF") }
3001
3001
  wb.sheet("Patterns") do |s|
@@ -3009,7 +3009,7 @@ end
3009
3009
 
3010
3010
  # 2. Read the generated sheet and print cell fill properties
3011
3011
  puts "=== Read Validation ==="
3012
- workbook = Xlsxrb.read(output_path)
3012
+ workbook = Xlsxrb.read(output_path).load
3013
3013
  sheet = workbook.sheets.first
3014
3014
  row = sheet.rows.first
3015
3015
  row.cells.each do |c|
@@ -3044,7 +3044,7 @@ Demonstrates solid cell background fill colors.
3044
3044
 
3045
3045
  require "xlsxrb"
3046
3046
  output_path = ARGV[0] || "fill_solid_colors.xlsx"
3047
- Xlsxrb.generate(output_path) do |wb|
3047
+ Xlsxrb.write(output_path) do |wb|
3048
3048
  wb.style("red_fill") { |s| s.fill_color("FFFFC7CE") }
3049
3049
  wb.style("green_fill") { |s| s.fill_color("FFC6EFCE") }
3050
3050
  wb.sheet("Fills") do |s|
@@ -3058,7 +3058,7 @@ end
3058
3058
 
3059
3059
  # 2. Read the generated sheet and print cell fill properties
3060
3060
  puts "=== Read Validation ==="
3061
- workbook = Xlsxrb.read(output_path)
3061
+ workbook = Xlsxrb.read(output_path).load
3062
3062
  sheet = workbook.sheets.first
3063
3063
  row = sheet.rows.first
3064
3064
  row.cells.each do |c|
@@ -3095,7 +3095,7 @@ require "xlsxrb"
3095
3095
 
3096
3096
  output_path = ARGV[0] || "fonts.xlsx"
3097
3097
 
3098
- Xlsxrb.generate(output_path) do |wb|
3098
+ Xlsxrb.write(output_path) do |wb|
3099
3099
  # Font Families (using nested hash options)
3100
3100
  wb.style("f_arial", font: { name: "Arial" })
3101
3101
  wb.style("f_times", font: { name: "Times New Roman" })
@@ -3188,7 +3188,7 @@ Demonstrates enabling auto-filter sorting headers on tables. Download the sheet
3188
3188
 
3189
3189
  require "xlsxrb"
3190
3190
  output_path = ARGV[0] || "interactive_autofilter.xlsx"
3191
- Xlsxrb.generate(output_path) do |wb|
3191
+ Xlsxrb.write(output_path) do |wb|
3192
3192
  wb.sheet("Filter") do |s|
3193
3193
  s.column(0, width: 25)
3194
3194
  s.column(1, width: 25)
@@ -3202,7 +3202,7 @@ end
3202
3202
 
3203
3203
  # 2. Read the generated sheet and print cell values
3204
3204
  puts "=== Read Validation ==="
3205
- workbook = Xlsxrb.read(output_path)
3205
+ workbook = Xlsxrb.read(output_path).load
3206
3206
  sheet = workbook.sheets.first
3207
3207
  sheet.rows.first(5).each do |row|
3208
3208
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -3241,7 +3241,7 @@ Demonstrates cell pop-up comments. Open the sheet in Excel and hover your mouse
3241
3241
 
3242
3242
  require "xlsxrb"
3243
3243
  output_path = ARGV[0] || "interactive_comments.xlsx"
3244
- Xlsxrb.generate(output_path) do |wb|
3244
+ Xlsxrb.write(output_path) do |wb|
3245
3245
  wb.sheet("Comments") do |s|
3246
3246
  s.column(0, width: 25)
3247
3247
  s.column(1, width: 25)
@@ -3252,7 +3252,7 @@ end
3252
3252
 
3253
3253
  # 2. Read the generated sheet and print cell values
3254
3254
  puts "=== Read Validation ==="
3255
- workbook = Xlsxrb.read(output_path)
3255
+ workbook = Xlsxrb.read(output_path).load
3256
3256
  sheet = workbook.sheets.first
3257
3257
  sheet.rows.first(5).each do |row|
3258
3258
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -3289,7 +3289,7 @@ Demonstrates interactive custom formula validation rules.
3289
3289
 
3290
3290
  require "xlsxrb"
3291
3291
  output_path = ARGV[0] || "interactive_validation_custom.xlsx"
3292
- Xlsxrb.generate(output_path) do |wb|
3292
+ Xlsxrb.write(output_path) do |wb|
3293
3293
  wb.sheet("Custom Rule") do |s|
3294
3294
  s.column(0, width: 25)
3295
3295
  s.column(1, width: 25)
@@ -3302,7 +3302,7 @@ end
3302
3302
  # 2. Read the generated sheet and print data validations
3303
3303
  puts "=== Read Validation ==="
3304
3304
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
3305
- workbook = Xlsxrb.read(output_path)
3305
+ workbook = Xlsxrb.read(output_path).load
3306
3306
  sheet = workbook.sheets.first
3307
3307
  validations = reader.data_validations(sheet: sheet.name)
3308
3308
  validations.each do |v|
@@ -3339,7 +3339,7 @@ Demonstrates interactive date range constraints validation rules.
3339
3339
 
3340
3340
  require "xlsxrb"
3341
3341
  output_path = ARGV[0] || "interactive_validation_date.xlsx"
3342
- Xlsxrb.generate(output_path) do |wb|
3342
+ Xlsxrb.write(output_path) do |wb|
3343
3343
  wb.sheet("Date Validation") do |s|
3344
3344
  s.column(0, width: 25)
3345
3345
  s.column(1, width: 25)
@@ -3351,7 +3351,7 @@ end
3351
3351
  # 2. Read the generated sheet and print data validations
3352
3352
  puts "=== Read Validation ==="
3353
3353
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
3354
- workbook = Xlsxrb.read(output_path)
3354
+ workbook = Xlsxrb.read(output_path).load
3355
3355
  sheet = workbook.sheets.first
3356
3356
  validations = reader.data_validations(sheet: sheet.name)
3357
3357
  validations.each do |v|
@@ -3388,7 +3388,7 @@ Demonstrates dropdown list data validations. Open the sheet in Excel and select
3388
3388
 
3389
3389
  require "xlsxrb"
3390
3390
  output_path = ARGV[0] || "interactive_validation_list.xlsx"
3391
- Xlsxrb.generate(output_path) do |wb|
3391
+ Xlsxrb.write(output_path) do |wb|
3392
3392
  wb.sheet("List Validation") do |s|
3393
3393
  s.column(0, width: 25)
3394
3394
  s.column(1, width: 25)
@@ -3400,7 +3400,7 @@ end
3400
3400
  # 2. Read the generated sheet and print data validations
3401
3401
  puts "=== Read Validation ==="
3402
3402
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
3403
- workbook = Xlsxrb.read(output_path)
3403
+ workbook = Xlsxrb.read(output_path).load
3404
3404
  sheet = workbook.sheets.first
3405
3405
  validations = reader.data_validations(sheet: sheet.name)
3406
3406
  validations.each do |v|
@@ -3437,7 +3437,7 @@ Demonstrates range constraints for whole number validations. Open the sheet in E
3437
3437
 
3438
3438
  require "xlsxrb"
3439
3439
  output_path = ARGV[0] || "interactive_validation_range.xlsx"
3440
- Xlsxrb.generate(output_path) do |wb|
3440
+ Xlsxrb.write(output_path) do |wb|
3441
3441
  wb.sheet("Range Validation") do |s|
3442
3442
  s.column(0, width: 25)
3443
3443
  s.column(1, width: 25)
@@ -3449,7 +3449,7 @@ end
3449
3449
  # 2. Read the generated sheet and print data validations
3450
3450
  puts "=== Read Validation ==="
3451
3451
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
3452
- workbook = Xlsxrb.read(output_path)
3452
+ workbook = Xlsxrb.read(output_path).load
3453
3453
  sheet = workbook.sheets.first
3454
3454
  validations = reader.data_validations(sheet: sheet.name)
3455
3455
  validations.each do |v|
@@ -3486,7 +3486,7 @@ Demonstrates interactive text length validation rules.
3486
3486
 
3487
3487
  require "xlsxrb"
3488
3488
  output_path = ARGV[0] || "interactive_validation_text_length.xlsx"
3489
- Xlsxrb.generate(output_path) do |wb|
3489
+ Xlsxrb.write(output_path) do |wb|
3490
3490
  wb.sheet("Text Length") do |s|
3491
3491
  s.column(0, width: 25)
3492
3492
  s.column(1, width: 25)
@@ -3498,7 +3498,7 @@ end
3498
3498
  # 2. Read the generated sheet and print data validations
3499
3499
  puts "=== Read Validation ==="
3500
3500
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
3501
- workbook = Xlsxrb.read(output_path)
3501
+ workbook = Xlsxrb.read(output_path).load
3502
3502
  sheet = workbook.sheets.first
3503
3503
  validations = reader.data_validations(sheet: sheet.name)
3504
3504
  validations.each do |v|
@@ -3535,7 +3535,7 @@ Demonstrates interactive time validation rules.
3535
3535
 
3536
3536
  require "xlsxrb"
3537
3537
  output_path = ARGV[0] || "interactive_validation_time.xlsx"
3538
- Xlsxrb.generate(output_path) do |wb|
3538
+ Xlsxrb.write(output_path) do |wb|
3539
3539
  wb.sheet("Time Validation") do |s|
3540
3540
  s.column(0, width: 25)
3541
3541
  s.column(1, width: 25)
@@ -3547,7 +3547,7 @@ end
3547
3547
  # 2. Read the generated sheet and print data validations
3548
3548
  puts "=== Read Validation ==="
3549
3549
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
3550
- workbook = Xlsxrb.read(output_path)
3550
+ workbook = Xlsxrb.read(output_path).load
3551
3551
  sheet = workbook.sheets.first
3552
3552
  validations = reader.data_validations(sheet: sheet.name)
3553
3553
  validations.each do |v|
@@ -3581,7 +3581,7 @@ require "xlsxrb"
3581
3581
 
3582
3582
  output_path = ARGV[0] || "japanese_text.xlsx"
3583
3583
 
3584
- Xlsxrb.generate(output_path) do |wb|
3584
+ Xlsxrb.write(output_path) do |wb|
3585
3585
  wb.style("ja_font") do |style|
3586
3586
  style.font_name("Noto Sans CJK JP").size(12)
3587
3587
  end
@@ -3596,7 +3596,7 @@ end
3596
3596
 
3597
3597
  # 2. Read the generated sheet and print parsed cell values and Ruby classes
3598
3598
  puts "=== Read Validation ==="
3599
- workbook = Xlsxrb.read(output_path)
3599
+ workbook = Xlsxrb.read(output_path).load
3600
3600
  sheet = workbook.sheets.first
3601
3601
  sheet.rows.each do |row|
3602
3602
  row_cells = row.cells.map do |c|
@@ -3633,7 +3633,7 @@ require "xlsxrb"
3633
3633
 
3634
3634
  output_path = ARGV[0] || "merge_freeze.xlsx"
3635
3635
 
3636
- Xlsxrb.generate(output_path) do |wb|
3636
+ Xlsxrb.write(output_path) do |wb|
3637
3637
  wb.style("title") { |style| style.border_all(style: "thin", color: "FF000000").align_horizontal("center") }
3638
3638
  wb.style("border") { |style| style.border_all(style: "thin", color: "FF000000") }
3639
3639
  wb.sheet("Merge & Freeze") do |s|
@@ -3654,7 +3654,7 @@ end
3654
3654
 
3655
3655
  # 2. Read the generated sheet and print cell values
3656
3656
  puts "=== Read Validation ==="
3657
- workbook = Xlsxrb.read(output_path)
3657
+ workbook = Xlsxrb.read(output_path).load
3658
3658
  sheet = workbook.sheets.first
3659
3659
  sheet.rows.first(5).each do |row|
3660
3660
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -3689,7 +3689,7 @@ Demonstrates enabling printing of grid lines.
3689
3689
 
3690
3690
  require "xlsxrb"
3691
3691
  output_path = ARGV[0] || "page_grid_lines_print.xlsx"
3692
- Xlsxrb.generate(output_path) do |wb|
3692
+ Xlsxrb.write(output_path) do |wb|
3693
3693
  wb.sheet("Print Grid Lines") do |s|
3694
3694
  s.column(0, width: 25)
3695
3695
  s.column(1, width: 25)
@@ -3701,7 +3701,7 @@ end
3701
3701
  # 2. Read the generated sheet and print page setup properties
3702
3702
  puts "=== Read Validation ==="
3703
3703
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
3704
- workbook = Xlsxrb.read(output_path)
3704
+ workbook = Xlsxrb.read(output_path).load
3705
3705
  sheet = workbook.sheets.first
3706
3706
  margins = reader.page_margins(sheet: sheet.name)
3707
3707
  setup = reader.page_setup(sheet: sheet.name)
@@ -3737,7 +3737,7 @@ Demonstrates setting odd page headers and footers.
3737
3737
 
3738
3738
  require "xlsxrb"
3739
3739
  output_path = ARGV[0] || "page_header_footer.xlsx"
3740
- Xlsxrb.generate(output_path) do |wb|
3740
+ Xlsxrb.write(output_path) do |wb|
3741
3741
  wb.sheet("Header Footer") do |s|
3742
3742
  s.column(0, width: 25)
3743
3743
  s.column(1, width: 25)
@@ -3749,7 +3749,7 @@ end
3749
3749
  # 2. Read the generated sheet and print page setup properties
3750
3750
  puts "=== Read Validation ==="
3751
3751
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
3752
- workbook = Xlsxrb.read(output_path)
3752
+ workbook = Xlsxrb.read(output_path).load
3753
3753
  sheet = workbook.sheets.first
3754
3754
  margins = reader.page_margins(sheet: sheet.name)
3755
3755
  setup = reader.page_setup(sheet: sheet.name)
@@ -3785,7 +3785,7 @@ Demonstrates enabling printing of row and column headings.
3785
3785
 
3786
3786
  require "xlsxrb"
3787
3787
  output_path = ARGV[0] || "page_headings_print.xlsx"
3788
- Xlsxrb.generate(output_path) do |wb|
3788
+ Xlsxrb.write(output_path) do |wb|
3789
3789
  wb.sheet("Print Headings") do |s|
3790
3790
  s.column(0, width: 25)
3791
3791
  s.column(1, width: 25)
@@ -3797,7 +3797,7 @@ end
3797
3797
  # 2. Read the generated sheet and print page setup properties
3798
3798
  puts "=== Read Validation ==="
3799
3799
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
3800
- workbook = Xlsxrb.read(output_path)
3800
+ workbook = Xlsxrb.read(output_path).load
3801
3801
  sheet = workbook.sheets.first
3802
3802
  margins = reader.page_margins(sheet: sheet.name)
3803
3803
  setup = reader.page_setup(sheet: sheet.name)
@@ -3833,7 +3833,7 @@ Demonstrates setting narrow page margins.
3833
3833
 
3834
3834
  require "xlsxrb"
3835
3835
  output_path = ARGV[0] || "page_margins_narrow.xlsx"
3836
- Xlsxrb.generate(output_path) do |wb|
3836
+ Xlsxrb.write(output_path) do |wb|
3837
3837
  wb.sheet("Narrow Margins") do |s|
3838
3838
  s.column(0, width: 25)
3839
3839
  s.column(1, width: 25)
@@ -3845,7 +3845,7 @@ end
3845
3845
  # 2. Read the generated sheet and print page setup properties
3846
3846
  puts "=== Read Validation ==="
3847
3847
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
3848
- workbook = Xlsxrb.read(output_path)
3848
+ workbook = Xlsxrb.read(output_path).load
3849
3849
  sheet = workbook.sheets.first
3850
3850
  margins = reader.page_margins(sheet: sheet.name)
3851
3851
  setup = reader.page_setup(sheet: sheet.name)
@@ -3881,7 +3881,7 @@ Demonstrates setting wide page margins.
3881
3881
 
3882
3882
  require "xlsxrb"
3883
3883
  output_path = ARGV[0] || "page_margins_wide.xlsx"
3884
- Xlsxrb.generate(output_path) do |wb|
3884
+ Xlsxrb.write(output_path) do |wb|
3885
3885
  wb.sheet("Wide Margins") do |s|
3886
3886
  s.column(0, width: 25)
3887
3887
  s.column(1, width: 25)
@@ -3893,7 +3893,7 @@ end
3893
3893
  # 2. Read the generated sheet and print page setup properties
3894
3894
  puts "=== Read Validation ==="
3895
3895
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
3896
- workbook = Xlsxrb.read(output_path)
3896
+ workbook = Xlsxrb.read(output_path).load
3897
3897
  sheet = workbook.sheets.first
3898
3898
  margins = reader.page_margins(sheet: sheet.name)
3899
3899
  setup = reader.page_setup(sheet: sheet.name)
@@ -3929,7 +3929,7 @@ Demonstrates landscape page setup for printing.
3929
3929
 
3930
3930
  require "xlsxrb"
3931
3931
  output_path = ARGV[0] || "page_orientation_landscape.xlsx"
3932
- Xlsxrb.generate(output_path) do |wb|
3932
+ Xlsxrb.write(output_path) do |wb|
3933
3933
  wb.sheet("Landscape") do |s|
3934
3934
  s.column(0, width: 25)
3935
3935
  s.column(1, width: 25)
@@ -3941,7 +3941,7 @@ end
3941
3941
  # 2. Read the generated sheet and print page setup properties
3942
3942
  puts "=== Read Validation ==="
3943
3943
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
3944
- workbook = Xlsxrb.read(output_path)
3944
+ workbook = Xlsxrb.read(output_path).load
3945
3945
  sheet = workbook.sheets.first
3946
3946
  margins = reader.page_margins(sheet: sheet.name)
3947
3947
  setup = reader.page_setup(sheet: sheet.name)
@@ -3977,7 +3977,7 @@ Demonstrates setting paper size to A3 (paper size 8).
3977
3977
 
3978
3978
  require "xlsxrb"
3979
3979
  output_path = ARGV[0] || "page_paper_size_a3.xlsx"
3980
- Xlsxrb.generate(output_path) do |wb|
3980
+ Xlsxrb.write(output_path) do |wb|
3981
3981
  wb.sheet("A3 Sheet") do |s|
3982
3982
  s.column(0, width: 25)
3983
3983
  s.column(1, width: 25)
@@ -3989,7 +3989,7 @@ end
3989
3989
  # 2. Read the generated sheet and print page setup properties
3990
3990
  puts "=== Read Validation ==="
3991
3991
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
3992
- workbook = Xlsxrb.read(output_path)
3992
+ workbook = Xlsxrb.read(output_path).load
3993
3993
  sheet = workbook.sheets.first
3994
3994
  margins = reader.page_margins(sheet: sheet.name)
3995
3995
  setup = reader.page_setup(sheet: sheet.name)
@@ -4025,7 +4025,7 @@ Demonstrates outline grouping for rows.
4025
4025
 
4026
4026
  require "xlsxrb"
4027
4027
  output_path = ARGV[0] || "row_grouping.xlsx"
4028
- Xlsxrb.generate(output_path) do |wb|
4028
+ Xlsxrb.write(output_path) do |wb|
4029
4029
  wb.style("parent") { |style| style.border_all(style: "thin", color: "FF000000").bold }
4030
4030
  wb.style("child") { |style| style.border_all(style: "thin", color: "FF000000").align_horizontal("left").indent(2) }
4031
4031
  wb.sheet("Row Grouping") do |s|
@@ -4039,7 +4039,7 @@ end
4039
4039
 
4040
4040
  # 2. Read the generated sheet and print row attributes
4041
4041
  puts "=== Read Validation ==="
4042
- workbook = Xlsxrb.read(output_path)
4042
+ workbook = Xlsxrb.read(output_path).load
4043
4043
  sheet = workbook.sheets.first
4044
4044
  sheet.rows.each do |row|
4045
4045
  puts "Row #{row.index}: height=#{row.height}, hidden=#{row.hidden}, outline_level=#{row.outline_level}"
@@ -4072,7 +4072,7 @@ Demonstrates setting very tall row heights.
4072
4072
 
4073
4073
  require "xlsxrb"
4074
4074
  output_path = ARGV[0] || "row_height_tall.xlsx"
4075
- Xlsxrb.generate(output_path) do |wb|
4075
+ Xlsxrb.write(output_path) do |wb|
4076
4076
  wb.style("border") { |style| style.border_all(style: "thin", color: "FF000000") }
4077
4077
  wb.sheet("Row Height") do |s|
4078
4078
  s.column(0, width: 25)
@@ -4084,7 +4084,7 @@ end
4084
4084
 
4085
4085
  # 2. Read the generated sheet and print row attributes
4086
4086
  puts "=== Read Validation ==="
4087
- workbook = Xlsxrb.read(output_path)
4087
+ workbook = Xlsxrb.read(output_path).load
4088
4088
  sheet = workbook.sheets.first
4089
4089
  sheet.rows.each do |row|
4090
4090
  puts "Row #{row.index}: height=#{row.height}, hidden=#{row.hidden}, outline_level=#{row.outline_level}"
@@ -4116,7 +4116,7 @@ Demonstrates setting custom row heights.
4116
4116
 
4117
4117
  require "xlsxrb"
4118
4118
  output_path = ARGV[0] || "row_heights.xlsx"
4119
- Xlsxrb.generate(output_path) do |wb|
4119
+ Xlsxrb.write(output_path) do |wb|
4120
4120
  wb.style("border") { |style| style.border_all(style: "thin", color: "FF000000") }
4121
4121
  wb.sheet("Heights") do |s|
4122
4122
  s.column(0, width: 25)
@@ -4128,7 +4128,7 @@ end
4128
4128
 
4129
4129
  # 2. Read the generated sheet and print row attributes
4130
4130
  puts "=== Read Validation ==="
4131
- workbook = Xlsxrb.read(output_path)
4131
+ workbook = Xlsxrb.read(output_path).load
4132
4132
  sheet = workbook.sheets.first
4133
4133
  sheet.rows.each do |row|
4134
4134
  puts "Row #{row.index}: height=#{row.height}, hidden=#{row.hidden}, outline_level=#{row.outline_level}"
@@ -4164,7 +4164,7 @@ Demonstrates customizing tab colors of individual worksheets.
4164
4164
 
4165
4165
  require "xlsxrb"
4166
4166
  output_path = ARGV[0] || "sheet_tab_colors.xlsx"
4167
- Xlsxrb.generate(output_path) do |wb|
4167
+ Xlsxrb.write(output_path) do |wb|
4168
4168
  wb.sheet("Red Tab") do |s|
4169
4169
  s.column(0, width: 25)
4170
4170
  s.column(1, width: 25)
@@ -4180,7 +4180,7 @@ end
4180
4180
  # 2. Read the generated sheet and print sheet properties
4181
4181
  puts "=== Read Validation ==="
4182
4182
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
4183
- workbook = Xlsxrb.read(output_path)
4183
+ workbook = Xlsxrb.read(output_path).load
4184
4184
  workbook.sheet_names.each do |s_name|
4185
4185
  props = reader.sheet_properties(sheet: s_name)
4186
4186
  puts "Sheet: #{s_name}, tab color: #{props[:tab_color].inspect}"
@@ -4212,7 +4212,7 @@ Demonstrates embedded column sparklines in cell ranges.
4212
4212
 
4213
4213
  require "xlsxrb"
4214
4214
  output_path = ARGV[0] || "sparkline_column.xlsx"
4215
- Xlsxrb.generate(output_path) do |wb|
4215
+ Xlsxrb.write(output_path) do |wb|
4216
4216
  wb.sheet("Sparkline") do |s|
4217
4217
  s.sheet_properties(:fit_to_page, true)
4218
4218
  s.page_setup(fit_to_width: 1, fit_to_height: 1)
@@ -4228,7 +4228,7 @@ end
4228
4228
 
4229
4229
  # 2. Read the generated sheet and print cell values
4230
4230
  puts "=== Read Validation ==="
4231
- workbook = Xlsxrb.read(output_path)
4231
+ workbook = Xlsxrb.read(output_path).load
4232
4232
  sheet = workbook.sheets.first
4233
4233
  sheet.rows.first(3).each do |row|
4234
4234
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -4262,7 +4262,7 @@ Demonstrates embedded line sparklines in cell ranges.
4262
4262
 
4263
4263
  require "xlsxrb"
4264
4264
  output_path = ARGV[0] || "sparkline_line.xlsx"
4265
- Xlsxrb.generate(output_path) do |wb|
4265
+ Xlsxrb.write(output_path) do |wb|
4266
4266
  wb.sheet("Sparkline") do |s|
4267
4267
  s.sheet_properties(:fit_to_page, true)
4268
4268
  s.page_setup(fit_to_width: 1, fit_to_height: 1)
@@ -4281,7 +4281,7 @@ end
4281
4281
 
4282
4282
  # 2. Read the generated sheet and print cell values
4283
4283
  puts "=== Read Validation ==="
4284
- workbook = Xlsxrb.read(output_path)
4284
+ workbook = Xlsxrb.read(output_path).load
4285
4285
  sheet = workbook.sheets.first
4286
4286
  sheet.rows.first(3).each do |row|
4287
4287
  row_cells = row.cells.map { |c| "#{c.ref}: #{c.value.inspect}" }
@@ -4315,7 +4315,7 @@ require "xlsxrb"
4315
4315
 
4316
4316
  output_path = ARGV[0] || "styles_fonts_fills.xlsx"
4317
4317
 
4318
- Xlsxrb.generate(output_path) do |wb|
4318
+ Xlsxrb.write(output_path) do |wb|
4319
4319
  wb.style("header") do |style|
4320
4320
  style.bold.size(14).font_color("FFFFFFFF").fill_color("FF4F81BD")
4321
4321
  end
@@ -4334,7 +4334,7 @@ end
4334
4334
 
4335
4335
  # 2. Read the generated sheet and print styling details
4336
4336
  puts "=== Read Validation ==="
4337
- workbook = Xlsxrb.read(output_path)
4337
+ workbook = Xlsxrb.read(output_path).load
4338
4338
  sheet = workbook.sheets.first
4339
4339
  sheet.rows.first(4).each do |row|
4340
4340
  row_cells = row.cells.map do |c|
@@ -4374,7 +4374,7 @@ Demonstrates disabling visible grid lines in spreadsheet view.
4374
4374
 
4375
4375
  require "xlsxrb"
4376
4376
  output_path = ARGV[0] || "view_show_grid_lines.xlsx"
4377
- Xlsxrb.generate(output_path) do |wb|
4377
+ Xlsxrb.write(output_path) do |wb|
4378
4378
  wb.sheet("Hide Grid Lines") do |s|
4379
4379
  s.column(0, width: 25)
4380
4380
  s.column(1, width: 25)
@@ -4386,7 +4386,7 @@ end
4386
4386
  # 2. Read the generated sheet and print view configurations
4387
4387
  puts "=== Read Validation ==="
4388
4388
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
4389
- workbook = Xlsxrb.read(output_path)
4389
+ workbook = Xlsxrb.read(output_path).load
4390
4390
  workbook.sheet_names.each do |s_name|
4391
4391
  view = reader.sheet_view(sheet: s_name)
4392
4392
  puts "Sheet '#{s_name}' views zoom scale: #{view[:zoom_scale]}%, show grid lines: #{view[:show_grid_lines]}"
@@ -4419,7 +4419,7 @@ Demonstrates setting custom zoom scale in sheet view (e.g. 150%).
4419
4419
 
4420
4420
  require "xlsxrb"
4421
4421
  output_path = ARGV[0] || "view_zoom_scale.xlsx"
4422
- Xlsxrb.generate(output_path) do |wb|
4422
+ Xlsxrb.write(output_path) do |wb|
4423
4423
  wb.sheet("Zoom 150") do |s|
4424
4424
  s.column(0, width: 25)
4425
4425
  s.column(1, width: 25)
@@ -4431,7 +4431,7 @@ end
4431
4431
  # 2. Read the generated sheet and print view configurations
4432
4432
  puts "=== Read Validation ==="
4433
4433
  reader = Xlsxrb::Ooxml::Reader.new(output_path)
4434
- workbook = Xlsxrb.read(output_path)
4434
+ workbook = Xlsxrb.read(output_path).load
4435
4435
  workbook.sheet_names.each do |s_name|
4436
4436
  view = reader.sheet_view(sheet: s_name)
4437
4437
  puts "Sheet '#{s_name}' views zoom scale: #{view[:zoom_scale]}%, show grid lines: #{view[:show_grid_lines]}"
@@ -4466,7 +4466,7 @@ Demonstrates creating workbooks with multiple worksheets.
4466
4466
 
4467
4467
  require "xlsxrb"
4468
4468
  output_path = ARGV[0] || "workbook_three_sheets.xlsx"
4469
- Xlsxrb.generate(output_path) do |wb|
4469
+ Xlsxrb.write(output_path) do |wb|
4470
4470
  wb.sheet("First Sheet") { |s| s.row(["First Sheet Data"]) }
4471
4471
  wb.sheet("Second Sheet") { |s| s.row(["Second Sheet Data"]) }
4472
4472
  wb.sheet("Third Sheet") { |s| s.row(["Third Sheet Data"]) }
@@ -4474,7 +4474,7 @@ end
4474
4474
 
4475
4475
  # 2. Read the generated sheet and print the sheets structure
4476
4476
  puts "=== Read Validation ==="
4477
- workbook = Xlsxrb.read(output_path)
4477
+ workbook = Xlsxrb.read(output_path).load
4478
4478
  puts "Workbook sheets: #{workbook.sheet_names.join(", ")}"
4479
4479
  ```
4480
4480