@univerjs/sheets 0.24.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/lib/cjs/facade.js +462 -235
  2. package/lib/cjs/index.js +68 -56
  3. package/lib/cjs/locale/ar-SA.js +52 -0
  4. package/lib/cjs/locale/ca-ES.js +36 -1
  5. package/lib/cjs/locale/de-DE.js +52 -0
  6. package/lib/cjs/locale/en-US.js +36 -1
  7. package/lib/cjs/locale/es-ES.js +36 -1
  8. package/lib/cjs/locale/fa-IR.js +36 -1
  9. package/lib/cjs/locale/fr-FR.js +36 -1
  10. package/lib/cjs/locale/id-ID.js +52 -0
  11. package/lib/cjs/locale/it-IT.js +52 -0
  12. package/lib/cjs/locale/ja-JP.js +36 -1
  13. package/lib/cjs/locale/ko-KR.js +36 -1
  14. package/lib/cjs/locale/pl-PL.js +52 -0
  15. package/lib/cjs/locale/pt-BR.js +52 -0
  16. package/lib/cjs/locale/ru-RU.js +36 -1
  17. package/lib/cjs/locale/sk-SK.js +36 -1
  18. package/lib/cjs/locale/vi-VN.js +36 -1
  19. package/lib/cjs/locale/zh-CN.js +36 -1
  20. package/lib/cjs/locale/zh-HK.js +52 -0
  21. package/lib/cjs/locale/zh-TW.js +36 -1
  22. package/lib/es/facade.js +462 -235
  23. package/lib/es/index.js +67 -57
  24. package/lib/es/locale/ar-SA.js +51 -0
  25. package/lib/es/locale/ca-ES.js +36 -1
  26. package/lib/es/locale/de-DE.js +51 -0
  27. package/lib/es/locale/en-US.js +36 -1
  28. package/lib/es/locale/es-ES.js +36 -1
  29. package/lib/es/locale/fa-IR.js +36 -1
  30. package/lib/es/locale/fr-FR.js +36 -1
  31. package/lib/es/locale/id-ID.js +51 -0
  32. package/lib/es/locale/it-IT.js +51 -0
  33. package/lib/es/locale/ja-JP.js +36 -1
  34. package/lib/es/locale/ko-KR.js +36 -1
  35. package/lib/es/locale/pl-PL.js +51 -0
  36. package/lib/es/locale/pt-BR.js +51 -0
  37. package/lib/es/locale/ru-RU.js +36 -1
  38. package/lib/es/locale/sk-SK.js +36 -1
  39. package/lib/es/locale/vi-VN.js +36 -1
  40. package/lib/es/locale/zh-CN.js +36 -1
  41. package/lib/es/locale/zh-HK.js +51 -0
  42. package/lib/es/locale/zh-TW.js +36 -1
  43. package/lib/facade.js +462 -235
  44. package/lib/index.js +67 -57
  45. package/lib/locale/ar-SA.js +51 -0
  46. package/lib/locale/ca-ES.js +36 -1
  47. package/lib/locale/de-DE.js +51 -0
  48. package/lib/locale/en-US.js +36 -1
  49. package/lib/locale/es-ES.js +36 -1
  50. package/lib/locale/fa-IR.js +36 -1
  51. package/lib/locale/fr-FR.js +36 -1
  52. package/lib/locale/id-ID.js +51 -0
  53. package/lib/locale/it-IT.js +51 -0
  54. package/lib/locale/ja-JP.js +36 -1
  55. package/lib/locale/ko-KR.js +36 -1
  56. package/lib/locale/pl-PL.js +51 -0
  57. package/lib/locale/pt-BR.js +51 -0
  58. package/lib/locale/ru-RU.js +36 -1
  59. package/lib/locale/sk-SK.js +36 -1
  60. package/lib/locale/vi-VN.js +36 -1
  61. package/lib/locale/zh-CN.js +36 -1
  62. package/lib/locale/zh-HK.js +51 -0
  63. package/lib/locale/zh-TW.js +36 -1
  64. package/lib/types/basics/utils.d.ts +2 -0
  65. package/lib/types/facade/f-range.d.ts +184 -92
  66. package/lib/types/facade/f-selection.d.ts +15 -8
  67. package/lib/types/facade/f-workbook.d.ts +12 -5
  68. package/lib/types/facade/f-worksheet.d.ts +202 -101
  69. package/lib/types/facade/permission/f-range-permission.d.ts +8 -4
  70. package/lib/types/facade/permission/f-range-protection-rule.d.ts +18 -9
  71. package/lib/types/facade/permission/f-worksheet-permission.d.ts +36 -18
  72. package/lib/types/index.d.ts +1 -1
  73. package/lib/types/locale/ar-SA.d.ts +18 -0
  74. package/lib/types/locale/de-DE.d.ts +18 -0
  75. package/lib/types/locale/en-US.d.ts +39 -0
  76. package/lib/types/locale/id-ID.d.ts +18 -0
  77. package/lib/types/locale/it-IT.d.ts +18 -0
  78. package/lib/types/locale/pl-PL.d.ts +18 -0
  79. package/lib/types/locale/pt-BR.d.ts +18 -0
  80. package/lib/types/locale/zh-HK.d.ts +18 -0
  81. package/lib/umd/facade.js +1 -1
  82. package/lib/umd/index.js +2 -2
  83. package/lib/umd/locale/ar-SA.js +1 -0
  84. package/lib/umd/locale/ca-ES.js +1 -1
  85. package/lib/umd/locale/de-DE.js +1 -0
  86. package/lib/umd/locale/en-US.js +1 -1
  87. package/lib/umd/locale/es-ES.js +1 -1
  88. package/lib/umd/locale/fa-IR.js +1 -1
  89. package/lib/umd/locale/fr-FR.js +1 -1
  90. package/lib/umd/locale/id-ID.js +1 -0
  91. package/lib/umd/locale/it-IT.js +1 -0
  92. package/lib/umd/locale/ja-JP.js +1 -1
  93. package/lib/umd/locale/ko-KR.js +1 -1
  94. package/lib/umd/locale/pl-PL.js +1 -0
  95. package/lib/umd/locale/pt-BR.js +1 -0
  96. package/lib/umd/locale/ru-RU.js +1 -1
  97. package/lib/umd/locale/sk-SK.js +1 -1
  98. package/lib/umd/locale/vi-VN.js +1 -1
  99. package/lib/umd/locale/zh-CN.js +1 -1
  100. package/lib/umd/locale/zh-HK.js +1 -0
  101. package/lib/umd/locale/zh-TW.js +1 -1
  102. package/package.json +9 -9
package/lib/es/facade.js CHANGED
@@ -4,7 +4,7 @@ import { AddRangeProtectionMutation, AddWorksheetProtectionMutation, AppendRowCo
4
4
  import { FormulaDataModel, IDefinedNamesService, IFunctionService, ISuperTableService, deserializeRangeWithSheet, serializeRange, serializeRangeWithSheet } from "@univerjs/engine-formula";
5
5
  import { ObjectScope, UnitAction, UnitObject as UnitObject$1, UnitRole } from "@univerjs/protocol";
6
6
 
7
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
7
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
8
8
  function _typeof(o) {
9
9
  "@babel/helpers - typeof";
10
10
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -15,7 +15,7 @@ function _typeof(o) {
15
15
  }
16
16
 
17
17
  //#endregion
18
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
18
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
19
19
  function toPrimitive(t, r) {
20
20
  if ("object" != _typeof(t) || !t) return t;
21
21
  var e = t[Symbol.toPrimitive];
@@ -28,14 +28,14 @@ function toPrimitive(t, r) {
28
28
  }
29
29
 
30
30
  //#endregion
31
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
31
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
32
32
  function toPropertyKey(t) {
33
33
  var i = toPrimitive(t, "string");
34
34
  return "symbol" == _typeof(i) ? i : i + "";
35
35
  }
36
36
 
37
37
  //#endregion
38
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
38
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
39
39
  function _defineProperty(e, r, t) {
40
40
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
41
41
  value: t,
@@ -46,7 +46,7 @@ function _defineProperty(e, r, t) {
46
46
  }
47
47
 
48
48
  //#endregion
49
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
49
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
50
50
  function __decorateParam(paramIndex, decorator) {
51
51
  return function(target, key) {
52
52
  decorator(target, key, paramIndex);
@@ -54,7 +54,7 @@ function __decorateParam(paramIndex, decorator) {
54
54
  }
55
55
 
56
56
  //#endregion
57
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
57
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
58
58
  function __decorate(decorators, target, key, desc) {
59
59
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
60
60
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -73,13 +73,13 @@ function __decorate(decorators, target, key, desc) {
73
73
  */
74
74
  function getDefinedNameFieldName(unitId, localeService, definedNamesService) {
75
75
  const definedNameMap = definedNamesService.getDefinedNameMap(unitId);
76
- if (definedNameMap == null) return localeService.t("definedName.defaultName") + 1;
76
+ if (definedNameMap == null) return localeService.t("sheets.definedName.defaultName") + 1;
77
77
  const count = Array.from(Object.values(definedNameMap)).length + 1;
78
- const name = localeService.t("definedName.defaultName") + count;
78
+ const name = localeService.t("sheets.definedName.defaultName") + count;
79
79
  if (definedNamesService.getValueByName(unitId, name) == null) return name;
80
80
  let i = count + 1;
81
81
  while (true) {
82
- const newName = localeService.t("definedName.defaultName") + i;
82
+ const newName = localeService.t("sheets.definedName.defaultName") + i;
83
83
  if (definedNamesService.getValueByName(unitId, newName) == null) return newName;
84
84
  i++;
85
85
  }
@@ -579,7 +579,8 @@ let FSelection = _FSelection = class FSelection {
579
579
  * @example
580
580
  * ```ts
581
581
  * const fWorkbook = univerAPI.getActiveWorkbook();
582
- * const fWorksheet = fWorkbook.getActiveSheet();
582
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
583
+ * if (!fWorksheet) return;
583
584
  * const fRange = fWorksheet.getRange('A10:B11');
584
585
  * fRange.activate();
585
586
  * const fSelection = fWorksheet.getSelection();
@@ -597,7 +598,8 @@ let FSelection = _FSelection = class FSelection {
597
598
  * @example
598
599
  * ```ts
599
600
  * const fWorkbook = univerAPI.getActiveWorkbook();
600
- * const fWorksheet = fWorkbook.getActiveSheet();
601
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
602
+ * if (!fWorksheet) return;
601
603
  * const fSelection = fWorksheet.getSelection();
602
604
  * const activeRangeList = fSelection.getActiveRangeList();
603
605
  * activeRangeList.forEach((range) => {
@@ -616,7 +618,8 @@ let FSelection = _FSelection = class FSelection {
616
618
  * @example
617
619
  * ```ts
618
620
  * const fWorkbook = univerAPI.getActiveWorkbook();
619
- * const fWorksheet = fWorkbook.getActiveSheet();
621
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
622
+ * if (!fWorksheet) return;
620
623
  * const fRange = fWorksheet.getRange('A10:B11');
621
624
  * fRange.activate();
622
625
  * const fSelection = fWorksheet.getSelection();
@@ -637,10 +640,11 @@ let FSelection = _FSelection = class FSelection {
637
640
  * @example
638
641
  * ```ts
639
642
  * const fWorkbook = univerAPI.getActiveWorkbook();
640
- * const fWorksheet = fWorkbook.getActiveSheet();
643
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
644
+ * if (!fWorksheet) return;
641
645
  * const fSelection = fWorksheet.getSelection();
642
646
  * const activeSheet = fSelection.getActiveSheet();
643
- * console.log(activeSheet.equalTo(fWorksheet)); // true
647
+ * console.log(activeSheet.equalTo(fWorksheet));
644
648
  * ```
645
649
  */
646
650
  getActiveSheet() {
@@ -654,7 +658,8 @@ let FSelection = _FSelection = class FSelection {
654
658
  * @example
655
659
  * ```ts
656
660
  * const fWorkbook = univerAPI.getActiveWorkbook();
657
- * const fWorksheet = fWorkbook.getActiveSheet();
661
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
662
+ * if (!fWorksheet) return;
658
663
  * const fRange = fWorksheet.getRange('A10:B11');
659
664
  * fRange.activate();
660
665
  * const cell = fWorksheet.getRange('B11');
@@ -705,7 +710,8 @@ let FSelection = _FSelection = class FSelection {
705
710
  * @example
706
711
  * ```ts
707
712
  * const fWorkbook = univerAPI.getActiveWorkbook();
708
- * const fWorksheet = fWorkbook.getActiveSheet();
713
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
714
+ * if (!fWorksheet) return;
709
715
  * // make sure the active cell is A1 and selection is A1:B2
710
716
  * const fRange = fWorksheet.getRange('A1:B2');
711
717
  * fRange.activate();
@@ -1050,7 +1056,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
1050
1056
  * @example
1051
1057
  * ```ts
1052
1058
  * const fWorkbook = univerAPI.getActiveWorkbook();
1053
- * const fWorksheet = fWorkbook.getActiveSheet();
1059
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1060
+ * if (!fWorksheet) return;
1054
1061
  * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
1055
1062
  * // Update the ranges to A1:C3 for the first rule
1056
1063
  * if (rules.length > 0) {
@@ -1086,7 +1093,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
1086
1093
  * @example
1087
1094
  * ```ts
1088
1095
  * const fWorkbook = univerAPI.getActiveWorkbook();
1089
- * const fWorksheet = fWorkbook.getActiveSheet();
1096
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1097
+ * if (!fWorksheet) return;
1090
1098
  * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
1091
1099
  * // Remove the first protection rule
1092
1100
  * if (rules.length > 0) {
@@ -1125,7 +1133,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
1125
1133
  * @example
1126
1134
  * ```ts
1127
1135
  * const fWorkbook = univerAPI.getActiveWorkbook();
1128
- * const fWorksheet = fWorkbook.getActiveSheet();
1136
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1137
+ * if (!fWorksheet) return;
1129
1138
  * const fRange = fWorksheet.getRange('A1:B2');
1130
1139
  * // First, create a protection rule
1131
1140
  * const rule = await fRange.getRangePermission().protect({ name: 'My Range', allowEdit: true });
@@ -1163,7 +1172,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
1163
1172
  * @example
1164
1173
  * ```ts
1165
1174
  * const fWorkbook = univerAPI.getActiveWorkbook();
1166
- * const fWorksheet = fWorkbook.getActiveSheet();
1175
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1176
+ * if (!fWorksheet) return;
1167
1177
  * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
1168
1178
  * // Check if the first rule allows editing
1169
1179
  * if (rules.length > 0) {
@@ -1190,7 +1200,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
1190
1200
  * @example
1191
1201
  * ```ts
1192
1202
  * const fWorkbook = univerAPI.getActiveWorkbook();
1193
- * const fWorksheet = fWorkbook.getActiveSheet();
1203
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1204
+ * if (!fWorksheet) return;
1194
1205
  * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
1195
1206
  * // Check if the first rule allows editing
1196
1207
  * const rule = rules[0];
@@ -1208,7 +1219,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
1208
1219
  * @example
1209
1220
  * ```ts
1210
1221
  * const fWorkbook = univerAPI.getActiveWorkbook();
1211
- * const fWorksheet = fWorkbook.getActiveSheet();
1222
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1223
+ * if (!fWorksheet) return;
1212
1224
  * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
1213
1225
  * // Check if the first rule allows viewing
1214
1226
  * const rule = rules[0];
@@ -1226,7 +1238,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
1226
1238
  * @example
1227
1239
  * ```ts
1228
1240
  * const fWorkbook = univerAPI.getActiveWorkbook();
1229
- * const fWorksheet = fWorkbook.getActiveSheet();
1241
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1242
+ * if (!fWorksheet) return;
1230
1243
  * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
1231
1244
  * // Check if the first rule allows managing collaborators
1232
1245
  * const rule = rules[0];
@@ -1244,7 +1257,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
1244
1257
  * @example
1245
1258
  * ```ts
1246
1259
  * const fWorkbook = univerAPI.getActiveWorkbook();
1247
- * const fWorksheet = fWorkbook.getActiveSheet();
1260
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1261
+ * if (!fWorksheet) return;
1248
1262
  * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
1249
1263
  * // Check if the first rule allows deleting the rule
1250
1264
  * const rule = rules[0];
@@ -1262,7 +1276,8 @@ let FRangeProtectionRule = class FRangeProtectionRule {
1262
1276
  * @example
1263
1277
  * ```ts
1264
1278
  * const fWorkbook = univerAPI.getActiveWorkbook();
1265
- * const fWorksheet = fWorkbook.getActiveSheet();
1279
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1280
+ * if (!fWorksheet) return;
1266
1281
  * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
1267
1282
  * // Get the permission snapshot of the first rule
1268
1283
  * if (rules.length > 0) {
@@ -1312,7 +1327,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1312
1327
  * @example
1313
1328
  * ```ts
1314
1329
  * const fWorkbook = univerAPI.getActiveWorkbook();
1315
- * const fWorksheet = fWorkbook.getActiveSheet();
1330
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1331
+ * if (!fWorksheet) return;
1316
1332
  * if (fWorksheet.getWorksheetPermission().isProtected()) {
1317
1333
  * console.log('Worksheet is protected');
1318
1334
  * }
@@ -1329,7 +1345,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1329
1345
  * @example
1330
1346
  * ```ts
1331
1347
  * const fWorkbook = univerAPI.getActiveWorkbook();
1332
- * const fWorksheet = fWorkbook.getActiveSheet();
1348
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1349
+ * if (!fWorksheet) return;
1333
1350
  * const permission = fWorksheet.getWorksheetPermission();
1334
1351
  *
1335
1352
  * // Create worksheet protection with collaborators
@@ -1407,7 +1424,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1407
1424
  * @example
1408
1425
  * ```ts
1409
1426
  * const fWorkbook = univerAPI.getActiveWorkbook();
1410
- * const fWorksheet = fWorkbook.getActiveSheet();
1427
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1428
+ * if (!fWorksheet) return;
1411
1429
  * await fWorksheet.getWorksheetPermission().unprotect();
1412
1430
  * ```
1413
1431
  */
@@ -1432,7 +1450,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1432
1450
  * @example
1433
1451
  * ```ts
1434
1452
  * const fWorkbook = univerAPI.getActiveWorkbook();
1435
- * const fWorksheet = fWorkbook.getActiveSheet();
1453
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1454
+ * if (!fWorksheet) return;
1436
1455
  * await fWorksheet.getWorksheetPermission().setMode('readOnly');
1437
1456
  * ```
1438
1457
  */
@@ -1472,7 +1491,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1472
1491
  * @example
1473
1492
  * ```ts
1474
1493
  * const fWorkbook = univerAPI.getActiveWorkbook();
1475
- * const fWorksheet = fWorkbook.getActiveSheet();
1494
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1495
+ * if (!fWorksheet) return;
1476
1496
  * await fWorksheet.getWorksheetPermission().setReadOnly();
1477
1497
  * ```
1478
1498
  */
@@ -1485,7 +1505,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1485
1505
  * @example
1486
1506
  * ```ts
1487
1507
  * const fWorkbook = univerAPI.getActiveWorkbook();
1488
- * const fWorksheet = fWorkbook.getActiveSheet();
1508
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1509
+ * if (!fWorksheet) return;
1489
1510
  * await fWorksheet.getWorksheetPermission().setEditable();
1490
1511
  * ```
1491
1512
  */
@@ -1501,7 +1522,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1501
1522
  * @example
1502
1523
  * ```ts
1503
1524
  * const fWorkbook = univerAPI.getActiveWorkbook();
1504
- * const fWorksheet = fWorkbook.getActiveSheet();
1525
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1526
+ * if (!fWorksheet) return;
1505
1527
  * const permission = fWorksheet.getWorksheetPermission();
1506
1528
  * await permission.setPoint(univerAPI.Enum.WorksheetPermissionPoint.InsertRow, false);
1507
1529
  * ```
@@ -1536,7 +1558,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1536
1558
  * @example
1537
1559
  * ```ts
1538
1560
  * const fWorkbook = univerAPI.getActiveWorkbook();
1539
- * const fWorksheet = fWorkbook.getActiveSheet();
1561
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1562
+ * if (!fWorksheet) return;
1540
1563
  * if (fWorksheet.getWorksheetPermission().canEdit()) {
1541
1564
  * console.log('Worksheet is editable');
1542
1565
  * }
@@ -1553,7 +1576,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1553
1576
  * @example
1554
1577
  * ```ts
1555
1578
  * const fWorkbook = univerAPI.getActiveWorkbook();
1556
- * const fWorksheet = fWorkbook.getActiveSheet();
1579
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1580
+ * if (!fWorksheet) return;
1557
1581
  * // Check if cell C3 can be edited
1558
1582
  * const fRange = fWorksheet.getRange('C3');
1559
1583
  * const canEdit = fWorksheet.getWorksheetPermission().canEditCell(fRange.getRow(), fRange.getColumn());
@@ -1577,7 +1601,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1577
1601
  * @example
1578
1602
  * ```ts
1579
1603
  * const fWorkbook = univerAPI.getActiveWorkbook();
1580
- * const fWorksheet = fWorkbook.getActiveSheet();
1604
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1605
+ * if (!fWorksheet) return;
1581
1606
  * if (fWorksheet.getWorksheetPermission().canView()) {
1582
1607
  * console.log('Worksheet is viewable');
1583
1608
  * }
@@ -1593,7 +1618,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1593
1618
  * @example
1594
1619
  * ```ts
1595
1620
  * const fWorkbook = univerAPI.getActiveWorkbook();
1596
- * const fWorksheet = fWorkbook.getActiveSheet();
1621
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1622
+ * if (!fWorksheet) return;
1597
1623
  * // Check if cell C3 can be viewed
1598
1624
  * const fRange = fWorksheet.getRange('C3');
1599
1625
  * const canView = fWorksheet.getWorksheetPermission().canViewCell(fRange.getRow(), fRange.getColumn());
@@ -1618,7 +1644,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1618
1644
  * @example
1619
1645
  * ```ts
1620
1646
  * const fWorkbook = univerAPI.getActiveWorkbook();
1621
- * const fWorksheet = fWorkbook.getActiveSheet();
1647
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1648
+ * if (!fWorksheet) return;
1622
1649
  * const permission = fWorksheet.getWorksheetPermission();
1623
1650
  * const canInsertRow = permission.getPoint(univerAPI.Enum.WorksheetPermissionPoint.InsertRow);
1624
1651
  * console.log(canInsertRow);
@@ -1638,7 +1665,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1638
1665
  * @example
1639
1666
  * ```ts
1640
1667
  * const fWorkbook = univerAPI.getActiveWorkbook();
1641
- * const fWorksheet = fWorkbook.getActiveSheet();
1668
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1669
+ * if (!fWorksheet) return;
1642
1670
  * const snapshot = fWorksheet.getWorksheetPermission().getSnapshot();
1643
1671
  * console.log(snapshot);
1644
1672
  * ```
@@ -1657,7 +1685,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1657
1685
  * @returns {Promise<void>} A promise that resolves when the configuration is applied.
1658
1686
  * @example
1659
1687
  * ```ts
1660
- * const worksheet = univerAPI.getActiveWorkbook()?.getActiveSheet();
1688
+ * const worksheet = univerAPI.getActiveWorkbook()?.getSheetByName('Sheet1');
1689
+ * if (!worksheet) return;
1661
1690
  * const permission = worksheet?.getWorksheetPermission();
1662
1691
  * await permission?.applyConfig({
1663
1692
  * mode: 'readOnly',
@@ -1688,7 +1717,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1688
1717
  * @example
1689
1718
  * ```ts
1690
1719
  * const fWorkbook = univerAPI.getActiveWorkbook();
1691
- * const fWorksheet = fWorkbook.getActiveSheet();
1720
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1721
+ * if (!fWorksheet) return;
1692
1722
  * const rules = await fWorksheet.getWorksheetPermission().protectRanges([
1693
1723
  * {
1694
1724
  * ranges: [fWorksheet.getRange('A1:B2')],
@@ -1777,7 +1807,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1777
1807
  * @example
1778
1808
  * ```ts
1779
1809
  * const fWorkbook = univerAPI.getActiveWorkbook();
1780
- * const fWorksheet = fWorkbook.getActiveSheet();
1810
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1811
+ * if (!fWorksheet) return;
1781
1812
  * const worksheetPermission = fWorksheet.getWorksheetPermission();
1782
1813
  * const rules = await worksheetPermission.listRangeProtectionRules();
1783
1814
  * // Unprotect the first rule as an example
@@ -1803,7 +1834,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1803
1834
  * @example
1804
1835
  * ```ts
1805
1836
  * const fWorkbook = univerAPI.getActiveWorkbook();
1806
- * const fWorksheet = fWorkbook.getActiveSheet();
1837
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1838
+ * if (!fWorksheet) return;
1807
1839
  * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
1808
1840
  * console.log(rules);
1809
1841
  * ```
@@ -1822,7 +1854,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1822
1854
  * @example
1823
1855
  * ```ts
1824
1856
  * const fWorkbook = univerAPI.getActiveWorkbook();
1825
- * const fWorksheet = fWorkbook.getActiveSheet();
1857
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
1858
+ * if (!fWorksheet) return;
1826
1859
  * // Get debug info for cell C3
1827
1860
  * const fRange = fWorksheet.getRange('C3');
1828
1861
  * const debugInfo = await fWorksheet.getWorksheetPermission().debugCellPermission(fRange.getRow(), fRange.getColumn());
@@ -1982,7 +2015,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
1982
2015
  * @returns This sheet, for chaining
1983
2016
  * @example
1984
2017
  * ```ts
1985
- * const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet();
2018
+ * const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2019
+ * if (!fWorkSheet) return;
1986
2020
  * fWorkSheet.setActiveSelection(fWorkSheet.getRange('A10:B10'));
1987
2021
  * ```
1988
2022
  */
@@ -2001,7 +2035,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2001
2035
  * @returns {Worksheet} The worksheet instance.
2002
2036
  * @example
2003
2037
  * ```typescript
2004
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2038
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2039
+ * if (!fWorksheet) return;
2005
2040
  * const sheet = fWorksheet.getSheet();
2006
2041
  * console.log(sheet);
2007
2042
  * ```
@@ -2014,7 +2049,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2014
2049
  * @returns {Injector} The injector instance.
2015
2050
  * @example
2016
2051
  * ```typescript
2017
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2052
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2053
+ * if (!fWorksheet) return;
2018
2054
  * const injector = fWorksheet.getInject();
2019
2055
  * console.log(injector);
2020
2056
  * ```
@@ -2027,7 +2063,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2027
2063
  * @returns {Workbook} The workbook instance.
2028
2064
  * @example
2029
2065
  * ```typescript
2030
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2066
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2067
+ * if (!fWorksheet) return;
2031
2068
  * const workbook = fWorksheet.getWorkbook();
2032
2069
  * console.log(workbook);
2033
2070
  * ```
@@ -2040,7 +2077,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2040
2077
  * @returns {string} The id of the worksheet.
2041
2078
  * @example
2042
2079
  * ```typescript
2043
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2080
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2081
+ * if (!fWorksheet) return;
2044
2082
  * const sheetId = fWorksheet.getSheetId();
2045
2083
  * console.log(sheetId);
2046
2084
  * ```
@@ -2053,7 +2091,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2053
2091
  * @returns {string} The name of the worksheet.
2054
2092
  * @example
2055
2093
  * ```typescript
2056
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2094
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2095
+ * if (!fWorksheet) return;
2057
2096
  * const sheetName = fWorksheet.getSheetName();
2058
2097
  * console.log(sheetName);
2059
2098
  * ```
@@ -2066,7 +2105,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2066
2105
  * @returns {FSelection} return the current selections of the worksheet or null if there is no selection.
2067
2106
  * @example
2068
2107
  * ```typescript
2069
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2108
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2109
+ * if (!fWorksheet) return;
2070
2110
  * const selection = fWorksheet.getSelection();
2071
2111
  * console.log(selection);
2072
2112
  * ```
@@ -2081,7 +2121,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2081
2121
  * @returns {IStyleData} Default style of the worksheet.
2082
2122
  * @example
2083
2123
  * ```typescript
2084
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2124
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2125
+ * if (!fWorksheet) return;
2085
2126
  * const defaultStyle = fWorksheet.getDefaultStyle();
2086
2127
  * console.log(defaultStyle);
2087
2128
  * ```
@@ -2096,7 +2137,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2096
2137
  * @returns {(Nullable<IStyleData> | string)} The default style of the worksheet row name or style data
2097
2138
  * @example
2098
2139
  * ```typescript
2099
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2140
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2141
+ * if (!fWorksheet) return;
2100
2142
  * // Get default style for row 0 (1)
2101
2143
  * const rowStyle = fWorksheet.getRowDefaultStyle(0);
2102
2144
  * console.log(rowStyle);
@@ -2115,7 +2157,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2115
2157
  * @returns {(Nullable<IStyleData> | string)} The default style of the worksheet column name or style data
2116
2158
  * @example
2117
2159
  * ```typescript
2118
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2160
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2161
+ * if (!fWorksheet) return;
2119
2162
  * // Get default style for column 0 (A)
2120
2163
  * const colStyle = fWorksheet.getColumnDefaultStyle(0);
2121
2164
  * console.log(colStyle);
@@ -2133,7 +2176,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2133
2176
  * @returns {FWorksheet} This worksheet instance for chaining
2134
2177
  * @example
2135
2178
  * ```typescript
2136
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2179
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2180
+ * if (!fWorksheet) return;
2137
2181
  * fWorksheet.setDefaultStyle('default');
2138
2182
  * // or
2139
2183
  * // fWorksheet.setDefaultStyle({fs: 12, ff: 'Arial'});
@@ -2158,7 +2202,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2158
2202
  * @example
2159
2203
  * ```ts
2160
2204
  * const fWorkbook = univerAPI.getActiveWorkbook();
2161
- * const fWorksheet = fWorkbook.getActiveSheet();
2205
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
2206
+ * if (!fWorksheet) return;
2162
2207
  * fWorksheet.setColumnDefaultStyle(0, 'default');
2163
2208
  * // or
2164
2209
  * // fWorksheet.setColumnDefaultStyle(0, {fs: 12, ff: 'Arial'});
@@ -2181,7 +2226,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2181
2226
  * @example
2182
2227
  * ```ts
2183
2228
  * const fWorkbook = univerAPI.getActiveWorkbook();
2184
- * const fWorksheet = fWorkbook.getActiveSheet();
2229
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
2230
+ * if (!fWorksheet) return;
2185
2231
  * fWorksheet.setRowDefaultStyle(0, 'default');
2186
2232
  * // or
2187
2233
  * // fWorksheet.setRowDefaultStyle(0, {fs: 12, ff: 'Arial'});
@@ -2235,7 +2281,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2235
2281
  * @returns {number} The maximum columns count of the sheet
2236
2282
  * @example
2237
2283
  * ```typescript
2238
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2284
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2285
+ * if (!fWorksheet) return;
2239
2286
  * const totalColumns = fWorksheet.getMaxColumns();
2240
2287
  * console.log(`Sheet has ${totalColumns} columns`);
2241
2288
  * ```
@@ -2248,7 +2295,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2248
2295
  * @returns {number}The maximum rows count of the sheet
2249
2296
  * @example
2250
2297
  * ```typescript
2251
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2298
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2299
+ * if (!fWorksheet) return;
2252
2300
  * const totalRows = fWorksheet.getMaxRows();
2253
2301
  * console.log(`Sheet has ${totalRows} rows`);
2254
2302
  * ```
@@ -2262,7 +2310,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2262
2310
  * @returns {FWorksheet} This sheet, for chaining.
2263
2311
  * @example
2264
2312
  * ```typescript
2265
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2313
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2314
+ * if (!fWorksheet) return;
2266
2315
  * // Insert a row after the third row
2267
2316
  * fWorksheet.insertRowAfter(2);
2268
2317
  * // Insert a row after the first row
@@ -2278,7 +2327,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2278
2327
  * @returns {FWorksheet} This sheet, for chaining.
2279
2328
  * @example
2280
2329
  * ```typescript
2281
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2330
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2331
+ * if (!fWorksheet) return;
2282
2332
  * // Insert a row before the third row
2283
2333
  * fWorksheet.insertRowBefore(2);
2284
2334
  * // Insert a row before the first row
@@ -2295,7 +2345,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2295
2345
  * @returns {FWorksheet} This sheet, for chaining.
2296
2346
  * @example
2297
2347
  * ```typescript
2298
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2348
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2349
+ * if (!fWorksheet) return;
2299
2350
  * // Insert 3 rows before the third row
2300
2351
  * fWorksheet.insertRows(2, 3);
2301
2352
  * // Insert 1 row before the first row
@@ -2312,7 +2363,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2312
2363
  * @returns {FWorksheet} This sheet, for chaining.
2313
2364
  * @example
2314
2365
  * ```typescript
2315
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2366
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2367
+ * if (!fWorksheet) return;
2316
2368
  * // Insert 3 rows after the third row
2317
2369
  * fWorksheet.insertRowsAfter(2, 3);
2318
2370
  * // Insert 1 row after the first row
@@ -2349,7 +2401,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2349
2401
  * @returns {FWorksheet} This sheet, for chaining.
2350
2402
  * @example
2351
2403
  * ```typescript
2352
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2404
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2405
+ * if (!fWorksheet) return;
2353
2406
  * // Insert 3 rows before the third row
2354
2407
  * fWorksheet.insertRowsBefore(2, 3);
2355
2408
  * // Insert 1 row before the first row
@@ -2385,7 +2438,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2385
2438
  * @returns {FWorksheet} This sheet, for chaining.
2386
2439
  * @example
2387
2440
  * ```typescript
2388
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2441
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2442
+ * if (!fWorksheet) return;
2389
2443
  * // Delete the third row
2390
2444
  * fWorksheet.deleteRow(2);
2391
2445
  * // Delete the first row
@@ -2402,7 +2456,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2402
2456
  * @returns {FWorksheet} This sheet, for chaining.
2403
2457
  * @example
2404
2458
  * ```typescript
2405
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2459
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2460
+ * if (!fWorksheet) return;
2406
2461
  * // Delete 3 rows at row index 2 (rows 3-5)
2407
2462
  * fWorksheet.deleteRows(2, 3);
2408
2463
  * // Delete 1 row at row index 0 (first row)
@@ -2429,7 +2484,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2429
2484
  * @returns {FWorksheet} This sheet, for chaining.
2430
2485
  * @example
2431
2486
  * ```typescript
2432
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2487
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2488
+ * if (!fWorksheet) return;
2433
2489
  * // Delete rows at index 2, and range from index 4 to 6 (rows 3, 5-7)
2434
2490
  * fWorksheet.deleteRowsByPoints([2, [4, 6]]);
2435
2491
  * ```
@@ -2447,7 +2503,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2447
2503
  * @returns {FWorksheet} This sheet, for chaining.
2448
2504
  * @example
2449
2505
  * ```typescript
2450
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2506
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2507
+ * if (!fWorksheet) return;
2451
2508
  * // Move 3 rows at row index 2 (rows 3-5) to row index 0
2452
2509
  * const rowSpec1 = fWorksheet.getRange('3:5');
2453
2510
  * fWorksheet.moveRows(rowSpec1, 0);
@@ -2482,7 +2539,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2482
2539
  * @returns {FWorksheet} This sheet, for chaining.
2483
2540
  * @example
2484
2541
  * ```typescript
2485
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2542
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2543
+ * if (!fWorksheet) return;
2486
2544
  * // Hide 3 rows starting from row index 1 (rows 2-4)
2487
2545
  * const row1 = fWorksheet.getRange('2:4');
2488
2546
  * fWorksheet.hideRow(row1);
@@ -2509,7 +2567,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2509
2567
  * @returns {FWorksheet} This sheet, for chaining.
2510
2568
  * @example
2511
2569
  * ```typescript
2512
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2570
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2571
+ * if (!fWorksheet) return;
2513
2572
  * // Hide 3 rows starting from row index 1 (rows 2-4)
2514
2573
  * fWorksheet.hideRows(1, 3);
2515
2574
  * // Hide single row at index 0 (first row)
@@ -2539,7 +2598,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2539
2598
  * @returns {FWorksheet} This sheet, for chaining.
2540
2599
  * @example
2541
2600
  * ```typescript
2542
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2601
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2602
+ * if (!fWorksheet) return;
2543
2603
  * // Unhide 3 rows starting from row index 1 (rows 2-4)
2544
2604
  * const row1 = fWorksheet.getRange('2:4');
2545
2605
  * fWorksheet.unhideRow(row1);
@@ -2566,7 +2626,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2566
2626
  * @returns {FWorksheet} This worksheet instance for chaining
2567
2627
  * @example
2568
2628
  * ```typescript
2569
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2629
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2630
+ * if (!fWorksheet) return;
2570
2631
  * // Show 3 rows starting from row index 1 (rows 2-4)
2571
2632
  * fWorksheet.showRows(1, 3);
2572
2633
  * // Show single row at index 0 (first row)
@@ -2597,7 +2658,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2597
2658
  * @returns {FWorksheet} This worksheet instance for chaining
2598
2659
  * @example
2599
2660
  * ```typescript
2600
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2661
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2662
+ * if (!fWorksheet) return;
2601
2663
  * // Set the height of the second row to 30 pixels
2602
2664
  * fWorksheet.setRowHeight(1, 30);
2603
2665
  * // Set the height of the first row to 20 pixels
@@ -2614,7 +2676,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2614
2676
  * @returns {FWorksheet} This worksheet instance for chaining
2615
2677
  * @example
2616
2678
  * ```ts
2617
- * const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet();
2679
+ * const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2680
+ * if (!fWorkSheet) return;
2618
2681
  * fWorkSheet.autoFitRow(24);
2619
2682
  * ```
2620
2683
  */
@@ -2650,7 +2713,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2650
2713
  * @returns {FWorksheet} This worksheet instance for chaining
2651
2714
  * @example
2652
2715
  * ```typescript
2653
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2716
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2717
+ * if (!fWorksheet) return;
2654
2718
  * fWorksheet.setRowHeights(1, 10, 30);
2655
2719
  * ```
2656
2720
  */
@@ -2692,7 +2756,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2692
2756
  * @example
2693
2757
  * ```typescript
2694
2758
  * const fWorkbook = univerAPI.getActiveWorkbook();
2695
- * const fWorksheet = fWorkbook.getActiveSheet();
2759
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
2760
+ * if (!fWorksheet) return;
2696
2761
  *
2697
2762
  * // Set the value of the cell A1 to 'Hello, Univer!', set the font size to 30 and font weight to bold
2698
2763
  * const fRange = fWorksheet.getRange('A1');
@@ -2712,7 +2777,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2712
2777
  * @returns {FWorksheet} This worksheet instance for chaining
2713
2778
  * @example
2714
2779
  * ```typescript
2715
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2780
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2781
+ * if (!fWorksheet) return;
2716
2782
  * fWorksheet.setRowAutoHeight(1, 10);
2717
2783
  * ```
2718
2784
  */
@@ -2738,7 +2804,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2738
2804
  * @returns {FWorksheet} This worksheet instance for chaining
2739
2805
  * @example
2740
2806
  * ```typescript
2741
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2807
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2808
+ * if (!fWorksheet) return;
2742
2809
  * const ranges = [
2743
2810
  * { startRow: 1, endRow: 10, startColumn: 0, endColumn: 10 },
2744
2811
  * { startRow: 11, endRow: 20, startColumn: 0, endColumn: 10 },
@@ -2764,7 +2831,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2764
2831
  * @returns {FWorksheet} This worksheet instance for chaining
2765
2832
  * @example
2766
2833
  * ```typescript
2767
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2834
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2835
+ * if (!fWorksheet) return;
2768
2836
  * fWorksheet.setRowHeightsForced(1, 10, 30);
2769
2837
  * ```
2770
2838
  */
@@ -2791,7 +2859,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2791
2859
  * @returns {FWorksheet} This worksheet instance for chaining
2792
2860
  * @example
2793
2861
  * ```typescript
2794
- * const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet();
2862
+ * const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2863
+ * if (!fWorkSheet) return;
2795
2864
  * fWorkSheet.setRowCustom({ 0: { key: 'value' } });
2796
2865
  * ```
2797
2866
  */
@@ -2814,7 +2883,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2814
2883
  * @returns {FWorksheet} This worksheet instance for chaining
2815
2884
  * @example
2816
2885
  * ```typescript
2817
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2886
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2887
+ * if (!fWorksheet) return;
2818
2888
  * // Insert a column after column C
2819
2889
  * fWorksheet.insertColumnAfter(2);
2820
2890
  * // Insert a column after column A
@@ -2830,7 +2900,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2830
2900
  * @returns {FWorksheet} This worksheet instance for chaining
2831
2901
  * @example
2832
2902
  * ```typescript
2833
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2903
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2904
+ * if (!fWorksheet) return;
2834
2905
  * // Insert a column before column C
2835
2906
  * fWorksheet.insertColumnBefore(2);
2836
2907
  * // Insert a column before column A
@@ -2847,7 +2918,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2847
2918
  * @returns {FWorksheet} This sheet, for chaining
2848
2919
  * @example
2849
2920
  * ```typescript
2850
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2921
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2922
+ * if (!fWorksheet) return;
2851
2923
  * // Insert 3 columns before column C
2852
2924
  * fWorksheet.insertColumns(2, 3);
2853
2925
  * // Insert 1 column before column A
@@ -2864,7 +2936,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2864
2936
  * @returns {FWorksheet} This sheet, for chaining
2865
2937
  * @example
2866
2938
  * ```typescript
2867
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2939
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2940
+ * if (!fWorksheet) return;
2868
2941
  * // Insert 3 columns after column C
2869
2942
  * fWorksheet.insertColumnsAfter(2, 3);
2870
2943
  * // Insert 1 column after column A
@@ -2901,7 +2974,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2901
2974
  * @returns {FWorksheet} This sheet, for chaining
2902
2975
  * @example
2903
2976
  * ```typescript
2904
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
2977
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
2978
+ * if (!fWorksheet) return;
2905
2979
  * // Insert 3 columns before column C
2906
2980
  * fWorksheet.insertColumnsBefore(2, 3);
2907
2981
  * // Insert 1 column before column A
@@ -2937,7 +3011,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2937
3011
  * @returns {FWorksheet} This sheet, for chaining
2938
3012
  * @example
2939
3013
  * ```typescript
2940
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3014
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3015
+ * if (!fWorksheet) return;
2941
3016
  * // Delete column C
2942
3017
  * fWorksheet.deleteColumn(2);
2943
3018
  * // Delete column A
@@ -2954,7 +3029,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2954
3029
  * @returns {FWorksheet} This sheet, for chaining
2955
3030
  * @example
2956
3031
  * ```typescript
2957
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3032
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3033
+ * if (!fWorksheet) return;
2958
3034
  * // Delete 3 columns at column index 2 (columns C, D, E)
2959
3035
  * fWorksheet.deleteColumns(2, 3);
2960
3036
  * // Delete 1 column at column index 0 (column A)
@@ -2981,7 +3057,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2981
3057
  * @returns {FWorksheet} This sheet, for chaining
2982
3058
  * @example
2983
3059
  * ```typescript
2984
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3060
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3061
+ * if (!fWorksheet) return;
2985
3062
  * // Delete columns at index 2, and range from index 4 to 6 (columns C, E-G)
2986
3063
  * fWorksheet.deleteColumnsByPoints([2, [4, 6]]);
2987
3064
  * ```
@@ -2999,7 +3076,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
2999
3076
  * @returns {FWorksheet} This sheet, for chaining
3000
3077
  * @example
3001
3078
  * ```typescript
3002
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3079
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3080
+ * if (!fWorksheet) return;
3003
3081
  * // Move columns C, D, E to column index 2 (columns B, C, D)
3004
3082
  * const columnSpec1 = fWorksheet.getRange('C:E');
3005
3083
  * fWorksheet.moveColumns(columnSpec1, 1);
@@ -3034,7 +3112,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3034
3112
  * @returns {FWorksheet} This sheet, for chaining
3035
3113
  * @example
3036
3114
  * ```typescript
3037
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3115
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3116
+ * if (!fWorksheet) return;
3038
3117
  * // Hide columns C, D, E
3039
3118
  * const column1 = fWorksheet.getRange('C:E');
3040
3119
  * fWorksheet.hideColumn(column1);
@@ -3061,7 +3140,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3061
3140
  * @returns {FWorksheet} This sheet, for chaining
3062
3141
  * @example
3063
3142
  * ```typescript
3064
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3143
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3144
+ * if (!fWorksheet) return;
3065
3145
  * // Hide columns C, D, E
3066
3146
  * fWorksheet.hideColumns(2, 3);
3067
3147
  * // Hide column A
@@ -3091,7 +3171,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3091
3171
  * @returns {FWorksheet} This sheet, for chaining
3092
3172
  * @example
3093
3173
  * ```typescript
3094
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3174
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3175
+ * if (!fWorksheet) return;
3095
3176
  * // Unhide columns C, D, E
3096
3177
  * const column1 = fWorksheet.getRange('C:E');
3097
3178
  * fWorksheet.unhideColumn(column1);
@@ -3118,7 +3199,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3118
3199
  * @returns {FWorksheet} This sheet, for chaining
3119
3200
  * @example
3120
3201
  * ```typescript
3121
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3202
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3203
+ * if (!fWorksheet) return;
3122
3204
  * // Unhide columns C, D, E
3123
3205
  * fWorksheet.showColumns(2, 3);
3124
3206
  * // Unhide column A
@@ -3149,7 +3231,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3149
3231
  * @returns {FWorksheet} This sheet, for chaining
3150
3232
  * @example
3151
3233
  * ```typescript
3152
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3234
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3235
+ * if (!fWorksheet) return;
3153
3236
  * // Set width of column B to 100 pixels
3154
3237
  * fWorksheet.setColumnWidth(1, 100);
3155
3238
  * ```
@@ -3165,7 +3248,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3165
3248
  * @returns {FWorksheet} This sheet, for chaining
3166
3249
  * @example
3167
3250
  * ```typescript
3168
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3251
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3252
+ * if (!fWorksheet) return;
3169
3253
  * // Set width of columns B-D (index 1-3) to 100 pixels
3170
3254
  * fWorksheet.setColumnWidths(1, 3, 100);
3171
3255
  * ```
@@ -3194,7 +3278,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3194
3278
  * @example
3195
3279
  * ```typescript
3196
3280
  * const fWorkbook = univerAPI.getActiveWorkbook();
3197
- * const fWorksheet = fWorkbook.getActiveSheet();
3281
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
3282
+ * if (!fWorksheet) return;
3198
3283
  *
3199
3284
  * // Set the long text value in cell A1
3200
3285
  * const fRange = fWorksheet.getRange('A1');
@@ -3216,7 +3301,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3216
3301
  * @returns {FWorksheet} This worksheet instance for chaining
3217
3302
  * @example
3218
3303
  * ```ts
3219
- * const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet();
3304
+ * const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3305
+ * if (!fWorkSheet) return;
3220
3306
  * fWorkSheet.setColumnCustom({ 0: { key: 'value' } });
3221
3307
  * ```
3222
3308
  */
@@ -3238,7 +3324,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3238
3324
  * @returns {FRange[]} All the merged cells in the worksheet
3239
3325
  * @example
3240
3326
  * ```ts
3241
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3327
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3328
+ * if (!fWorksheet) return;
3242
3329
  * // Get all merged ranges in the sheet
3243
3330
  * const mergedData = fWorksheet.getMergeData();
3244
3331
  * // Process each merged range
@@ -3255,7 +3342,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3255
3342
  * @returns {FRange[]} all merged cells
3256
3343
  * @example
3257
3344
  * ```typescript
3258
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3345
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3346
+ * if (!fWorksheet) return;
3259
3347
  * // Get all merged ranges in the sheet
3260
3348
  * const mergedRanges = fWorksheet.getMergedRanges();
3261
3349
  * // Process each merged range
@@ -3274,7 +3362,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3274
3362
  * @returns {FRange|undefined} The merged cell data, or undefined if the cell is not merged
3275
3363
  * @example
3276
3364
  * ```ts
3277
- * const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet();
3365
+ * const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3366
+ * if (!fWorkSheet) return;
3278
3367
  * const merge = fWorkSheet.getCellMergeData(0, 0);
3279
3368
  * if (merge) {
3280
3369
  * console.log('Merged range:', merge.getA1Notation());
@@ -3290,7 +3379,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3290
3379
  * @returns {FRange | null} the active range
3291
3380
  * @example
3292
3381
  * ```typescript
3293
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3382
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3383
+ * if (!fWorksheet) return;
3294
3384
  * // Get the currently active range
3295
3385
  * const activeRange = fWorksheet.getActiveRange();
3296
3386
  * if (activeRange) {
@@ -3307,7 +3397,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3307
3397
  * @returns {FWorksheet} This sheet, for chaining
3308
3398
  * @example
3309
3399
  * ```ts
3310
- * const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet();
3400
+ * const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3401
+ * if (!fWorkSheet) return;
3311
3402
  * fWorkSheet.setActiveRange(fWorkSheet.getRange('A10:B10'));
3312
3403
  * ```
3313
3404
  */
@@ -3322,7 +3413,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3322
3413
  * @returns {FRange | null} The active cell
3323
3414
  * @example
3324
3415
  * ```typescript
3325
- * const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet();
3416
+ * const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3417
+ * if (!fWorkSheet) return;
3326
3418
  * console.log(fWorkSheet.getActiveCell().getA1Notation());
3327
3419
  * ```
3328
3420
  */
@@ -3336,7 +3428,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3336
3428
  * @returns {FWorksheet} This worksheet instance for chaining
3337
3429
  * @example
3338
3430
  * ```typescript
3339
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3431
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3432
+ * if (!fWorksheet) return;
3340
3433
  * // Freeze first 3 rows and 2 columns
3341
3434
  * fWorksheet.setFreeze({
3342
3435
  * startRow: 3,
@@ -3359,7 +3452,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3359
3452
  * @returns {FWorksheet} This worksheet instance for chaining
3360
3453
  * @example
3361
3454
  * ```typescript
3362
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3455
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3456
+ * if (!fWorksheet) return;
3363
3457
  * // Cancel freeze
3364
3458
  * fWorksheet.cancelFreeze();
3365
3459
  * ```
@@ -3376,7 +3470,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3376
3470
  * @returns {IFreeze} The freeze state of the current sheet
3377
3471
  * @example
3378
3472
  * ```typescript
3379
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3473
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3474
+ * if (!fWorksheet) return;
3380
3475
  * // Get the freeze state of the current sheet
3381
3476
  * const freeze = fWorksheet.getFreeze();
3382
3477
  * console.log(freeze);
@@ -3436,7 +3531,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3436
3531
  * @returns {number} The number of frozen columns, returns 0 if no columns are frozen.
3437
3532
  * @example
3438
3533
  * ```typescript
3439
- * const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet();
3534
+ * const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3535
+ * if (!fWorkSheet) return;
3440
3536
  * // Get the number of frozen columns
3441
3537
  * const frozenColumns = fWorkSheet.getFrozenColumns();
3442
3538
  * console.log(frozenColumns);
@@ -3452,7 +3548,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3452
3548
  * @returns {number} The number of frozen rows. returns 0 if no rows are frozen.
3453
3549
  * @example
3454
3550
  * ```typescript
3455
- * const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet();
3551
+ * const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3552
+ * if (!fWorkSheet) return;
3456
3553
  * // Get the number of frozen rows
3457
3554
  * const frozenRows = fWorkSheet.getFrozenRows();
3458
3555
  * console.log(frozenRows);
@@ -3468,7 +3565,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3468
3565
  * @returns {IRowRange} The range of the frozen rows.
3469
3566
  * @example
3470
3567
  * ```ts
3471
- * const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet();
3568
+ * const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3569
+ * if (!fWorkSheet) return;
3472
3570
  * // Get the range of the frozen rows
3473
3571
  * const frozenRows = fWorkSheet.getFrozenRowRange();
3474
3572
  * console.log(frozenRows);
@@ -3486,7 +3584,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3486
3584
  * @returns {IColumnRange} The range of the frozen columns.
3487
3585
  * @example
3488
3586
  * ```ts
3489
- * const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet();
3587
+ * const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3588
+ * if (!fWorkSheet) return;
3490
3589
  * // Get the range of the frozen columns
3491
3590
  * const frozenColumns = fWorkSheet.getFrozenColumnRange();
3492
3591
  * console.log(frozenColumns);
@@ -3504,7 +3603,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3504
3603
  * @returns {boolean} True if the sheet's gridlines are hidden; otherwise false.
3505
3604
  * @example
3506
3605
  * ```ts
3507
- * const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet();
3606
+ * const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3607
+ * if (!fWorkSheet) return;
3508
3608
  * // check if the gridlines are hidden
3509
3609
  * if (fWorkSheet.hasHiddenGridLines()) {
3510
3610
  * console.log('Gridlines are hidden');
@@ -3520,7 +3620,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3520
3620
  * @returns {FWorksheet} Returns the current worksheet instance for method chaining
3521
3621
  * @example
3522
3622
  * ``` ts
3523
- * const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet();
3623
+ * const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3624
+ * if (!fWorkSheet) return;
3524
3625
  * // hide the gridlines
3525
3626
  * fWorkSheet.setHiddenGridlines(true);
3526
3627
  * ```
@@ -3539,7 +3640,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3539
3640
  * @returns {FWorksheet} Returns the current worksheet instance for method chaining
3540
3641
  * @example
3541
3642
  * ```ts
3542
- * const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet();
3643
+ * const fWorkSheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3644
+ * if (!fWorkSheet) return;
3543
3645
  * // set the gridlines color to red
3544
3646
  * fWorkSheet.setGridLinesColor('#ff0000');
3545
3647
  * ```
@@ -3558,7 +3660,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3558
3660
  * @example
3559
3661
  * ```ts
3560
3662
  * const fWorkbook = univerAPI.getActiveWorkbook();
3561
- * const fWorkSheet = fWorkbook.getActiveSheet();
3663
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
3664
+ * if (!fWorkSheet) return;
3562
3665
  * // get the gridlines color of the sheet
3563
3666
  * console.log(fWorkSheet.getGridLinesColor());
3564
3667
  * ```
@@ -3573,7 +3676,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3573
3676
  * @example
3574
3677
  * ```ts
3575
3678
  * const fWorkbook = univerAPI.getActiveWorkbook();
3576
- * const fWorkSheet = fWorkbook.getActiveSheet();
3679
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
3680
+ * if (!fWorkSheet) return;
3577
3681
  * // set the tab color to red
3578
3682
  * fWorkSheet.setTabColor('#ff0000');
3579
3683
  * ```
@@ -3593,7 +3697,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3593
3697
  * @example
3594
3698
  * ```ts
3595
3699
  * const fWorkbook = univerAPI.getActiveWorkbook();
3596
- * const fWorkSheet = fWorkbook.getActiveSheet();
3700
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
3701
+ * if (!fWorkSheet) return;
3597
3702
  * // get the tab color of the sheet
3598
3703
  * console.log(fWorkSheet.getTabColor());
3599
3704
  * ```
@@ -3607,7 +3712,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3607
3712
  * @example
3608
3713
  * ```ts
3609
3714
  * const fWorkbook = univerAPI.getActiveWorkbook();
3610
- * const fWorkSheet = fWorkbook.getActiveSheet();
3715
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
3716
+ * if (!fWorkSheet) return;
3611
3717
  * // hide the active sheet
3612
3718
  * fWorkSheet.hideSheet();
3613
3719
  * ```
@@ -3660,7 +3766,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3660
3766
  * @example
3661
3767
  * ```ts
3662
3768
  * const fWorkbook = univerAPI.getActiveWorkbook();
3663
- * const fWorkSheet = fWorkbook.getActiveSheet();
3769
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
3770
+ * if (!fWorkSheet) return;
3664
3771
  * // set the sheet name to 'Sheet1'
3665
3772
  * fWorkSheet.setName('NewSheet1');
3666
3773
  * ```
@@ -3694,7 +3801,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3694
3801
  * @example
3695
3802
  * ```ts
3696
3803
  * const fWorkbook = univerAPI.getActiveWorkbook();
3697
- * const fWorkSheet = fWorkbook.getActiveSheet();
3804
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
3805
+ * if (!fWorkSheet) return;
3698
3806
  * // get the position of the active sheet
3699
3807
  * const position = fWorkSheet.getIndex();
3700
3808
  * console.log(position);
@@ -3712,7 +3820,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3712
3820
  * @example
3713
3821
  * ```ts
3714
3822
  * const fWorkbook = univerAPI.getActiveWorkbook();
3715
- * const fWorkSheet = fWorkbook.getActiveSheet();
3823
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
3824
+ * if (!fWorkSheet) return;
3716
3825
  * // clear the sheet of content and formatting information
3717
3826
  * fWorkSheet.clear();
3718
3827
  * // clear the sheet of content only
@@ -3745,7 +3854,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3745
3854
  * @example
3746
3855
  * ```typescript
3747
3856
  * const fWorkbook = univerAPI.getActiveWorkbook();
3748
- * const fWorkSheet = fWorkbook.getActiveSheet();
3857
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
3858
+ * if (!fWorkSheet) return;
3749
3859
  * // clear the sheet of content only
3750
3860
  * fWorkSheet.clearContents();
3751
3861
  * ```
@@ -3773,7 +3883,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3773
3883
  * @example
3774
3884
  * ```typescript
3775
3885
  * const fWorkbook = univerAPI.getActiveWorkbook();
3776
- * const fWorkSheet = fWorkbook.getActiveSheet();
3886
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
3887
+ * if (!fWorkSheet) return;
3777
3888
  * // clear the sheet of formatting only
3778
3889
  * fWorkSheet.clearFormats();
3779
3890
  * ```
@@ -3802,7 +3913,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3802
3913
  * @example
3803
3914
  * ```ts
3804
3915
  * const fWorkbook = univerAPI.getActiveWorkbook();
3805
- * const fWorkSheet = fWorkbook.getActiveSheet();
3916
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
3917
+ * if (!fWorkSheet) return;
3806
3918
  * // Assume the sheet is a empty sheet
3807
3919
  * const cellRange = fWorkSheet.getRange('J50');
3808
3920
  * cellRange.setValue('Hello World');
@@ -3819,7 +3931,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3819
3931
  * @example
3820
3932
  * ```ts
3821
3933
  * const fWorkbook = univerAPI.getActiveWorkbook();
3822
- * const fWorkSheet = fWorkbook.getActiveSheet();
3934
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
3935
+ * if (!fWorkSheet) return;
3823
3936
  * // Assume the sheet is a empty sheet
3824
3937
  * const cellRange = fWorkSheet.getRange('J50');
3825
3938
  * cellRange.setValue('Hello World');
@@ -3835,7 +3948,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3835
3948
  * @example
3836
3949
  * ```ts
3837
3950
  * const fWorkbook = univerAPI.getActiveWorkbook();
3838
- * const fWorkSheet = fWorkbook.getActiveSheet();
3951
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
3952
+ * if (!fWorkSheet) return;
3839
3953
  * // Assume the sheet is a empty sheet
3840
3954
  * const cellRange = fWorkSheet.getRange('J50');
3841
3955
  * cellRange.setValue('Hello World');
@@ -3853,7 +3967,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3853
3967
  * ```ts
3854
3968
  * const fWorkbook = univerAPI.getActiveWorkbook();
3855
3969
  * const sheets = fWorkbook.getSheets();
3856
- * const fWorkSheet = fWorkbook.getActiveSheet();
3970
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
3971
+ * if (!fWorkSheet) return;
3857
3972
  * console.log(fWorkSheet.equalTo(sheets[0])); // true, if the active sheet is the first sheet.
3858
3973
  * ```
3859
3974
  */
@@ -3868,7 +3983,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3868
3983
  * @example
3869
3984
  * ```ts
3870
3985
  * // The code below inserts a defined name
3871
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
3986
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
3987
+ * if (!fWorksheet) return;
3872
3988
  * fWorksheet.insertDefinedName('MyDefinedName', 'Sheet1!$A$1');
3873
3989
  * ```
3874
3990
  */
@@ -3882,7 +3998,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3882
3998
  * @example
3883
3999
  * ```ts
3884
4000
  * // The code below gets all the defined names in the worksheet
3885
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
4001
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
4002
+ * if (!fWorksheet) return;
3886
4003
  * const definedNames = fWorksheet.getDefinedNames();
3887
4004
  * console.log(definedNames, definedNames[0]?.getFormulaOrRefString());
3888
4005
  * ```
@@ -3897,7 +4014,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3897
4014
  * @example
3898
4015
  * ```ts
3899
4016
  * const fWorkbook = univerAPI.getActiveWorkbook();
3900
- * const fWorkSheet = fWorkbook.getActiveSheet();
4017
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
4018
+ * if (!fWorkSheet) return;
3901
4019
  * fWorkSheet.setCustomMetadata({ key: 'value' });
3902
4020
  * ```
3903
4021
  */
@@ -3911,7 +4029,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3911
4029
  * @example
3912
4030
  * ```ts
3913
4031
  * const fWorkbook = univerAPI.getActiveWorkbook();
3914
- * const fWorkSheet = fWorkbook.getActiveSheet();
4032
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
4033
+ * if (!fWorkSheet) return;
3915
4034
  * const custom = fWorkSheet.getCustomMetadata();
3916
4035
  * console.log(custom);
3917
4036
  * ```
@@ -3927,7 +4046,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3927
4046
  * @example
3928
4047
  * ```ts
3929
4048
  * const fWorkbook = univerAPI.getActiveWorkbook();
3930
- * const fWorkSheet = fWorkbook.getActiveSheet();
4049
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
4050
+ * if (!fWorkSheet) return;
3931
4051
  * fWorkSheet.setRowCustomMetadata(0, { key: 'value' });
3932
4052
  * ```
3933
4053
  */
@@ -3943,7 +4063,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3943
4063
  * @example
3944
4064
  * ```ts
3945
4065
  * const fWorkbook = univerAPI.getActiveWorkbook();
3946
- * const fWorkSheet = fWorkbook.getActiveSheet();
4066
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
4067
+ * if (!fWorkSheet) return;
3947
4068
  * fWorkSheet.setColumnCustomMetadata(0, { key: 'value' });
3948
4069
  * ```
3949
4070
  */
@@ -3958,7 +4079,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3958
4079
  * @example
3959
4080
  * ```ts
3960
4081
  * const fWorkbook = univerAPI.getActiveWorkbook();
3961
- * const fWorkSheet = fWorkbook.getActiveSheet();
4082
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
4083
+ * if (!fWorkSheet) return;
3962
4084
  * const custom = fWorkSheet.getRowCustomMetadata(0);
3963
4085
  * console.log(custom);
3964
4086
  * ```
@@ -3973,7 +4095,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3973
4095
  * @example
3974
4096
  * ```ts
3975
4097
  * const fWorkbook = univerAPI.getActiveWorkbook();
3976
- * const fWorkSheet = fWorkbook.getActiveSheet();
4098
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
4099
+ * if (!fWorkSheet) return;
3977
4100
  * const custom = fWorkSheet.getColumnCustomMetadata(0);
3978
4101
  * console.log(custom);
3979
4102
  * ```
@@ -3990,7 +4113,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
3990
4113
  * // Appends a new row with 4 columns to the bottom of the current
3991
4114
  * // data region in the sheet containing the values in the array.
3992
4115
  * const fWorkbook = univerAPI.getActiveWorkbook();
3993
- * const fWorkSheet = fWorkbook.getActiveSheet();
4116
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
4117
+ * if (!fWorkSheet) return;
3994
4118
  * fWorkSheet.appendRow([1, 'Hello Univer', true, '=A1']);
3995
4119
  * ```
3996
4120
  */
@@ -4020,7 +4144,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
4020
4144
  * @example
4021
4145
  * ```ts
4022
4146
  * const fWorkbook = univerAPI.getActiveWorkbook();
4023
- * const fWorkSheet = fWorkbook.getActiveSheet();
4147
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
4148
+ * if (!fWorkSheet) return;
4024
4149
  *
4025
4150
  * // Set the number of rows in the worksheet to 40
4026
4151
  * fWorkSheet.setRowCount(40);
@@ -4041,7 +4166,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
4041
4166
  * @example
4042
4167
  * ```ts
4043
4168
  * const fWorkbook = univerAPI.getActiveWorkbook();
4044
- * const fWorkSheet = fWorkbook.getActiveSheet();
4169
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
4170
+ * if (!fWorkSheet) return;
4045
4171
  *
4046
4172
  * // Set the number of columns in the worksheet to 10
4047
4173
  * fWorkSheet.setColumnCount(10);
@@ -4061,7 +4187,8 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
4061
4187
  * @returns {FWorksheetPermission} - The WorksheetPermission instance.
4062
4188
  * @example
4063
4189
  * ```ts
4064
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
4190
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
4191
+ * if (!fWorksheet) return;
4065
4192
  * const permission = fWorksheet.getWorksheetPermission();
4066
4193
  *
4067
4194
  * // Set worksheet to read-only mode
@@ -4115,7 +4242,8 @@ let FRangePermission = class FRangePermission extends FBase {
4115
4242
  * @example
4116
4243
  * ```ts
4117
4244
  * const fWorkbook = univerAPI.getActiveWorkbook();
4118
- * const fWorksheet = fWorkbook.getActiveSheet();
4245
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4246
+ * if (!fWorksheet) return;
4119
4247
  * const fRange = fWorksheet.getRange('A1:B2');
4120
4248
  * // Check if the A1:B2 range is protected
4121
4249
  * const isProtected = fRange.getRangePermission().isProtected();
@@ -4132,7 +4260,8 @@ let FRangePermission = class FRangePermission extends FBase {
4132
4260
  * @example
4133
4261
  * ```ts
4134
4262
  * const fWorkbook = univerAPI.getActiveWorkbook();
4135
- * const fWorksheet = fWorkbook.getActiveSheet();
4263
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4264
+ * if (!fWorksheet) return;
4136
4265
  * const fRange = fWorksheet.getRange('A1:B2');
4137
4266
  * const rule = await fRange.getRangePermission().protect({
4138
4267
  * name: 'My protected range',
@@ -4202,7 +4331,8 @@ let FRangePermission = class FRangePermission extends FBase {
4202
4331
  * @example
4203
4332
  * ```ts
4204
4333
  * const fWorkbook = univerAPI.getActiveWorkbook();
4205
- * const fWorksheet = fWorkbook.getActiveSheet();
4334
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4335
+ * if (!fWorksheet) return;
4206
4336
  * const fRange = fWorksheet.getRange('A1:B2');
4207
4337
  * const result = await fRange.getRangePermission().unprotect();
4208
4338
  * console.log(result);
@@ -4224,7 +4354,8 @@ let FRangePermission = class FRangePermission extends FBase {
4224
4354
  * @example
4225
4355
  * ```ts
4226
4356
  * const fWorkbook = univerAPI.getActiveWorkbook();
4227
- * const fWorksheet = fWorkbook.getActiveSheet();
4357
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4358
+ * if (!fWorksheet) return;
4228
4359
  * const fRange = fWorksheet.getRange('A1:B2');
4229
4360
  * const rules = await fRange.getRangePermission().listRules();
4230
4361
  * console.log(rules);
@@ -4268,7 +4399,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4268
4399
  * @example
4269
4400
  * ```ts
4270
4401
  * const fWorkbook = univerAPI.getActiveWorkbook();
4271
- * const fWorksheet = fWorkbook.getActiveSheet();
4402
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4403
+ * if (!fWorksheet) return;
4272
4404
  * const fRange = fWorksheet.getRange('A1:B2');
4273
4405
  * console.log(fRange.getUnitId());
4274
4406
  * ```
@@ -4282,7 +4414,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4282
4414
  * @example
4283
4415
  * ```ts
4284
4416
  * const fWorkbook = univerAPI.getActiveWorkbook();
4285
- * const fWorksheet = fWorkbook.getActiveSheet();
4417
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4418
+ * if (!fWorksheet) return;
4286
4419
  * const fRange = fWorksheet.getRange('A1:B2');
4287
4420
  * console.log(fRange.getSheetName());
4288
4421
  * ```
@@ -4296,7 +4429,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4296
4429
  * @example
4297
4430
  * ```ts
4298
4431
  * const fWorkbook = univerAPI.getActiveWorkbook();
4299
- * const fWorksheet = fWorkbook.getActiveSheet();
4432
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4433
+ * if (!fWorksheet) return;
4300
4434
  * const fRange = fWorksheet.getRange('A1:B2');
4301
4435
  * console.log(fRange.getSheetId());
4302
4436
  * ```
@@ -4310,7 +4444,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4310
4444
  * @example
4311
4445
  * ```ts
4312
4446
  * const fWorkbook = univerAPI.getActiveWorkbook();
4313
- * const fWorksheet = fWorkbook.getActiveSheet();
4447
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4448
+ * if (!fWorksheet) return;
4314
4449
  * const fRange = fWorksheet.getRange('A1:B2');
4315
4450
  * const range = fRange.getRange();
4316
4451
  * const { startRow, startColumn, endRow, endColumn } = range;
@@ -4326,7 +4461,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4326
4461
  * @example
4327
4462
  * ```ts
4328
4463
  * const fWorkbook = univerAPI.getActiveWorkbook();
4329
- * const fWorksheet = fWorkbook.getActiveSheet();
4464
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4465
+ * if (!fWorksheet) return;
4330
4466
  * const fRange = fWorksheet.getRange('A1:B2');
4331
4467
  * console.log(fRange.getRow()); // 0
4332
4468
  * ```
@@ -4340,7 +4476,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4340
4476
  * @example
4341
4477
  * ```ts
4342
4478
  * const fWorkbook = univerAPI.getActiveWorkbook();
4343
- * const fWorksheet = fWorkbook.getActiveSheet();
4479
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4480
+ * if (!fWorksheet) return;
4344
4481
  * const fRange = fWorksheet.getRange('A1:B2');
4345
4482
  * console.log(fRange.getLastRow()); // 1
4346
4483
  * ```
@@ -4354,7 +4491,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4354
4491
  * @example
4355
4492
  * ```ts
4356
4493
  * const fWorkbook = univerAPI.getActiveWorkbook();
4357
- * const fWorksheet = fWorkbook.getActiveSheet();
4494
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4495
+ * if (!fWorksheet) return;
4358
4496
  * const fRange = fWorksheet.getRange('A1:B2');
4359
4497
  * console.log(fRange.getColumn()); // 0
4360
4498
  * ```
@@ -4368,7 +4506,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4368
4506
  * @example
4369
4507
  * ```ts
4370
4508
  * const fWorkbook = univerAPI.getActiveWorkbook();
4371
- * const fWorksheet = fWorkbook.getActiveSheet();
4509
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4510
+ * if (!fWorksheet) return;
4372
4511
  * const fRange = fWorksheet.getRange('A1:B2');
4373
4512
  * console.log(fRange.getLastColumn()); // 1
4374
4513
  * ```
@@ -4382,7 +4521,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4382
4521
  * @example
4383
4522
  * ```ts
4384
4523
  * const fWorkbook = univerAPI.getActiveWorkbook();
4385
- * const fWorksheet = fWorkbook.getActiveSheet();
4524
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4525
+ * if (!fWorksheet) return;
4386
4526
  * const fRange = fWorksheet.getRange('A1:B2');
4387
4527
  * console.log(fRange.getWidth());
4388
4528
  * ```
@@ -4396,7 +4536,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4396
4536
  * @example
4397
4537
  * ```ts
4398
4538
  * const fWorkbook = univerAPI.getActiveWorkbook();
4399
- * const fWorksheet = fWorkbook.getActiveSheet();
4539
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4540
+ * if (!fWorksheet) return;
4400
4541
  * const fRange = fWorksheet.getRange('A1:B2');
4401
4542
  * console.log(fRange.getHeight());
4402
4543
  * ```
@@ -4410,7 +4551,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4410
4551
  * @example
4411
4552
  * ```ts
4412
4553
  * const fWorkbook = univerAPI.getActiveWorkbook();
4413
- * const fWorksheet = fWorkbook.getActiveSheet();
4554
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4555
+ * if (!fWorksheet) return;
4414
4556
  * const fRange = fWorksheet.getRange('A1:B2');
4415
4557
  * console.log(fRange.isMerged());
4416
4558
  * // merge cells A1:B2
@@ -4435,7 +4577,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4435
4577
  * @example
4436
4578
  * ```ts
4437
4579
  * const fWorkbook = univerAPI.getActiveWorkbook();
4438
- * const fWorksheet = fWorkbook.getActiveSheet();
4580
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4581
+ * if (!fWorksheet) return;
4439
4582
  * const fRange = fWorksheet.getRange('A1:B2');
4440
4583
  * console.log(fRange.getCellStyleData());
4441
4584
  * ```
@@ -4456,7 +4599,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4456
4599
  * @example
4457
4600
  * ```ts
4458
4601
  * const fWorkbook = univerAPI.getActiveWorkbook();
4459
- * const fWorksheet = fWorkbook.getActiveSheet();
4602
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4603
+ * if (!fWorksheet) return;
4460
4604
  * const fRange = fWorksheet.getRange('A1:B2');
4461
4605
  * console.log(fRange.getFontFamily());
4462
4606
  * ```
@@ -4477,7 +4621,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4477
4621
  * @example
4478
4622
  * ```ts
4479
4623
  * const fWorkbook = univerAPI.getActiveWorkbook();
4480
- * const fWorksheet = fWorkbook.getActiveSheet();
4624
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4625
+ * if (!fWorksheet) return;
4481
4626
  * const fRange = fWorksheet.getRange('A1:B2');
4482
4627
  * console.log(fRange.getFontSize());
4483
4628
  * ```
@@ -4498,7 +4643,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4498
4643
  * @example
4499
4644
  * ```ts
4500
4645
  * const fWorkbook = univerAPI.getActiveWorkbook();
4501
- * const fWorksheet = fWorkbook.getActiveSheet();
4646
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4647
+ * if (!fWorksheet) return;
4502
4648
  * const fRange = fWorksheet.getRange('A1:B2');
4503
4649
  * console.log(fRange.getCellStyle());
4504
4650
  * ```
@@ -4519,7 +4665,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4519
4665
  * @example
4520
4666
  * ```ts
4521
4667
  * const fWorkbook = univerAPI.getActiveWorkbook();
4522
- * const fWorksheet = fWorkbook.getActiveSheet();
4668
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4669
+ * if (!fWorksheet) return;
4523
4670
  * const fRange = fWorksheet.getRange('A1:B2');
4524
4671
  * console.log(fRange.getCellStyles());
4525
4672
  * ```
@@ -4542,7 +4689,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4542
4689
  * @example
4543
4690
  * ```ts
4544
4691
  * const fWorkbook = univerAPI.getActiveWorkbook();
4545
- * const fWorksheet = fWorkbook.getActiveSheet();
4692
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4693
+ * if (!fWorksheet) return;
4546
4694
  * const fRange = fWorksheet.getRange('A1:B2');
4547
4695
  * fRange.setValueForCell({
4548
4696
  * v: 0.2,
@@ -4567,7 +4715,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4567
4715
  * @example
4568
4716
  * ```ts
4569
4717
  * const fWorkbook = univerAPI.getActiveWorkbook();
4570
- * const fWorksheet = fWorkbook.getActiveSheet();
4718
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4719
+ * if (!fWorksheet) return;
4571
4720
  * const fRange = fWorksheet.getRange('A1:B2');
4572
4721
  * fRange.setValueForCell({
4573
4722
  * v: 0.2,
@@ -4606,7 +4755,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4606
4755
  * @example
4607
4756
  * ```ts
4608
4757
  * const fWorkbook = univerAPI.getActiveWorkbook();
4609
- * const fWorksheet = fWorkbook.getActiveSheet();
4758
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4759
+ * if (!fWorksheet) return;
4610
4760
  * const fRange = fWorksheet.getRange('A1:B2');
4611
4761
  * fRange.setValues([
4612
4762
  * [
@@ -4667,7 +4817,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4667
4817
  * @example
4668
4818
  * ```ts
4669
4819
  * const fWorkbook = univerAPI.getActiveWorkbook();
4670
- * const fWorksheet = fWorkbook.getActiveSheet();
4820
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4821
+ * if (!fWorksheet) return;
4671
4822
  * const fRange = fWorksheet.getRange('A1:B2');
4672
4823
  * fRange.setValues([
4673
4824
  * [
@@ -4727,7 +4878,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4727
4878
  * @example
4728
4879
  * ```ts
4729
4880
  * const fWorkbook = univerAPI.getActiveWorkbook();
4730
- * const fWorksheet = fWorkbook.getActiveSheet();
4881
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4882
+ * if (!fWorksheet) return;
4731
4883
  * const fRange = fWorksheet.getRange('A1:B2');
4732
4884
  * console.log(fRange.getCellData());
4733
4885
  * ```
@@ -4742,7 +4894,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4742
4894
  * @example
4743
4895
  * ```ts
4744
4896
  * const fWorkbook = univerAPI.getActiveWorkbook();
4745
- * const fWorksheet = fWorkbook.getActiveSheet();
4897
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4898
+ * if (!fWorksheet) return;
4746
4899
  * const fRange = fWorksheet.getRange('A1:B2');
4747
4900
  * console.log(fRange.getCellDatas());
4748
4901
  * ```
@@ -4756,7 +4909,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4756
4909
  * @example
4757
4910
  * ```ts
4758
4911
  * const fWorkbook = univerAPI.getActiveWorkbook();
4759
- * const fWorksheet = fWorkbook.getActiveSheet();
4912
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4913
+ * if (!fWorksheet) return;
4760
4914
  * const fRange = fWorksheet.getRange('A1:B2');
4761
4915
  * console.log(fRange.getCellDataGrid());
4762
4916
  * ```
@@ -4779,7 +4933,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4779
4933
  * @example
4780
4934
  * ```ts
4781
4935
  * const fWorkbook = univerAPI.getActiveWorkbook();
4782
- * const fWorksheet = fWorkbook.getActiveSheet();
4936
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4937
+ * if (!fWorksheet) return;
4783
4938
  * const fRange = fWorksheet.getRange('A1:B2');
4784
4939
  * console.log(fRange.getRichTextValue());
4785
4940
  * ```
@@ -4797,7 +4952,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4797
4952
  * @example
4798
4953
  * ```ts
4799
4954
  * const fWorkbook = univerAPI.getActiveWorkbook();
4800
- * const fWorksheet = fWorkbook.getActiveSheet();
4955
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4956
+ * if (!fWorksheet) return;
4801
4957
  * const fRange = fWorksheet.getRange('A1:B2');
4802
4958
  * console.log(fRange.getRichTextValues());
4803
4959
  * ```
@@ -4813,7 +4969,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4813
4969
  * @example
4814
4970
  * ```ts
4815
4971
  * const fWorkbook = univerAPI.getActiveWorkbook();
4816
- * const fWorksheet = fWorkbook.getActiveSheet();
4972
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4973
+ * if (!fWorksheet) return;
4817
4974
  * const fRange = fWorksheet.getRange('A1:B2');
4818
4975
  * console.log(fRange.getValueAndRichTextValue());
4819
4976
  * ```
@@ -4828,7 +4985,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4828
4985
  * @example
4829
4986
  * ```ts
4830
4987
  * const fWorkbook = univerAPI.getActiveWorkbook();
4831
- * const fWorksheet = fWorkbook.getActiveSheet();
4988
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
4989
+ * if (!fWorksheet) return;
4832
4990
  * const fRange = fWorksheet.getRange('A1:B2');
4833
4991
  * console.log(fRange.getValueAndRichTextValues());
4834
4992
  * ```
@@ -4842,7 +5000,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4842
5000
  * @example
4843
5001
  * ```ts
4844
5002
  * const fWorkbook = univerAPI.getActiveWorkbook();
4845
- * const fWorksheet = fWorkbook.getActiveSheet();
5003
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5004
+ * if (!fWorksheet) return;
4846
5005
  * const fRange = fWorksheet.getRange('A1:B2');
4847
5006
  * console.log(fRange.getFormula());
4848
5007
  * ```
@@ -4857,7 +5016,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4857
5016
  * @example
4858
5017
  * ```ts
4859
5018
  * const fWorkbook = univerAPI.getActiveWorkbook();
4860
- * const fWorksheet = fWorkbook.getActiveSheet();
5019
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5020
+ * if (!fWorksheet) return;
4861
5021
  * const fRange = fWorksheet.getRange('A1:B2');
4862
5022
  * console.log(fRange.getFormulas());
4863
5023
  * ```
@@ -4883,7 +5043,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4883
5043
  * @example
4884
5044
  * ```ts
4885
5045
  * const fWorkbook = univerAPI.getActiveWorkbook();
4886
- * const fWorksheet = fWorkbook.getActiveSheet();
5046
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5047
+ * if (!fWorksheet) return;
4887
5048
  * const fRange = fWorksheet.getRange('A1:B2');
4888
5049
  * console.log(fRange.getWrap());
4889
5050
  * ```
@@ -4897,7 +5058,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4897
5058
  * @example
4898
5059
  * ```ts
4899
5060
  * const fWorkbook = univerAPI.getActiveWorkbook();
4900
- * const fWorksheet = fWorkbook.getActiveSheet();
5061
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5062
+ * if (!fWorksheet) return;
4901
5063
  * const fRange = fWorksheet.getRange('A1:B2');
4902
5064
  * console.log(fRange.getWraps());
4903
5065
  */
@@ -4915,7 +5077,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4915
5077
  * @example
4916
5078
  * ```ts
4917
5079
  * const fWorkbook = univerAPI.getActiveWorkbook();
4918
- * const fWorksheet = fWorkbook.getActiveSheet();
5080
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5081
+ * if (!fWorksheet) return;
4919
5082
  * const fRange = fWorksheet.getRange('A1:B2');
4920
5083
  * console.log(fRange.getWrapStrategy());
4921
5084
  * ```
@@ -4929,7 +5092,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4929
5092
  * @example
4930
5093
  * ```ts
4931
5094
  * const fWorkbook = univerAPI.getActiveWorkbook();
4932
- * const fWorksheet = fWorkbook.getActiveSheet();
5095
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5096
+ * if (!fWorksheet) return;
4933
5097
  * const fRange = fWorksheet.getRange('A1:B2');
4934
5098
  * console.log(fRange.getHorizontalAlignment());
4935
5099
  * ```
@@ -4943,7 +5107,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4943
5107
  * @example
4944
5108
  * ```ts
4945
5109
  * const fWorkbook = univerAPI.getActiveWorkbook();
4946
- * const fWorksheet = fWorkbook.getActiveSheet();
5110
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5111
+ * if (!fWorksheet) return;
4947
5112
  * const fRange = fWorksheet.getRange('A1:B2');
4948
5113
  * console.log(fRange.getHorizontalAlignments());
4949
5114
  * ```
@@ -4957,7 +5122,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4957
5122
  * @example
4958
5123
  * ```ts
4959
5124
  * const fWorkbook = univerAPI.getActiveWorkbook();
4960
- * const fWorksheet = fWorkbook.getActiveSheet();
5125
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5126
+ * if (!fWorksheet) return;
4961
5127
  * const fRange = fWorksheet.getRange('A1:B2');
4962
5128
  * console.log(fRange.getVerticalAlignment());
4963
5129
  * ```
@@ -4971,7 +5137,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4971
5137
  * @example
4972
5138
  * ```ts
4973
5139
  * const fWorkbook = univerAPI.getActiveWorkbook();
4974
- * const fWorksheet = fWorkbook.getActiveSheet();
5140
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5141
+ * if (!fWorksheet) return;
4975
5142
  * const fRange = fWorksheet.getRange('A1:B2');
4976
5143
  * console.log(fRange.getVerticalAlignments());
4977
5144
  * ```
@@ -4985,7 +5152,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
4985
5152
  * @returns {FRange} This range, for chaining
4986
5153
  * ```ts
4987
5154
  * const fWorkbook = univerAPI.getActiveWorkbook();
4988
- * const fWorksheet = fWorkbook.getActiveSheet();
5155
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5156
+ * if (!fWorksheet) return;
4989
5157
  * const fRange = fWorksheet.getRange('A1:B2');
4990
5158
  * fRange.setCustomMetaData({ key: 'value' });
4991
5159
  * console.log(fRange.getCustomMetaData());
@@ -5007,7 +5175,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5007
5175
  * @returns {FRange} This range, for chaining
5008
5176
  * ```ts
5009
5177
  * const fWorkbook = univerAPI.getActiveWorkbook();
5010
- * const fWorksheet = fWorkbook.getActiveSheet();
5178
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5179
+ * if (!fWorksheet) return;
5011
5180
  * const fRange = fWorksheet.getRange('A1:B2');
5012
5181
  * fRange.setCustomMetaDatas([
5013
5182
  * [{ key: 'value' }, { key: 'value2' }],
@@ -5032,7 +5201,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5032
5201
  * @example
5033
5202
  * ```
5034
5203
  * const fWorkbook = univerAPI.getActiveWorkbook();
5035
- * const fWorksheet = fWorkbook.getActiveSheet();
5204
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5205
+ * if (!fWorksheet) return;
5036
5206
  * const fRange = fWorksheet.getRange('A1:B2');
5037
5207
  * console.log(fRange.getCustomMetaData());
5038
5208
  * ```
@@ -5048,7 +5218,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5048
5218
  * @example
5049
5219
  * ```
5050
5220
  * const fWorkbook = univerAPI.getActiveWorkbook();
5051
- * const fWorksheet = fWorkbook.getActiveSheet();
5221
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5222
+ * if (!fWorksheet) return;
5052
5223
  * const fRange = fWorksheet.getRange('A1:B2');
5053
5224
  * console.log(fRange.getCustomMetaDatas());
5054
5225
  * ```
@@ -5068,7 +5239,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5068
5239
  * @example
5069
5240
  * ```ts
5070
5241
  * const fWorkbook = univerAPI.getActiveWorkbook();
5071
- * const fWorksheet = fWorkbook.getActiveSheet();
5242
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5243
+ * if (!fWorksheet) return;
5072
5244
  * const fRange = fWorksheet.getRange('A1:B2');
5073
5245
  * fRange.setBorder(univerAPI.Enum.BorderType.ALL, univerAPI.Enum.BorderStyleTypes.THIN, '#ff0000');
5074
5246
  * ```
@@ -5092,7 +5264,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5092
5264
  * @example
5093
5265
  * ```ts
5094
5266
  * const fWorkbook = univerAPI.getActiveWorkbook();
5095
- * const fWorksheet = fWorkbook.getActiveSheet();
5267
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5268
+ * if (!fWorksheet) return;
5096
5269
  * const fRange = fWorksheet.getRange('A1:B2');
5097
5270
  * console.log(fRange.getBackground());
5098
5271
  * ```
@@ -5108,7 +5281,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5108
5281
  * @example
5109
5282
  * ```ts
5110
5283
  * const fWorkbook = univerAPI.getActiveWorkbook();
5111
- * const fWorksheet = fWorkbook.getActiveSheet();
5284
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5285
+ * if (!fWorksheet) return;
5112
5286
  * const fRange = fWorksheet.getRange('A1:B2');
5113
5287
  * console.log(fRange.getBackgrounds());
5114
5288
  * ```
@@ -5126,7 +5300,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5126
5300
  * @example
5127
5301
  * ```ts
5128
5302
  * const fWorkbook = univerAPI.getActiveWorkbook();
5129
- * const fWorksheet = fWorkbook.getActiveSheet();
5303
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5304
+ * if (!fWorksheet) return;
5130
5305
  * const fRange = fWorksheet.getRange('A1:B2');
5131
5306
  * fRange.setBackgroundColor('red');
5132
5307
  * ```
@@ -5150,7 +5325,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5150
5325
  * @example
5151
5326
  * ```typescript
5152
5327
  * const fWorkbook = univerAPI.getActiveWorkbook();
5153
- * const fWorksheet = fWorkbook.getActiveSheet();
5328
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5329
+ * if (!fWorksheet) return;
5154
5330
  * const fRange = fWorksheet.getRange('A1:B2');
5155
5331
  * fRange.setBackground('red');
5156
5332
  * ```
@@ -5166,7 +5342,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5166
5342
  * @example
5167
5343
  * ```typescript
5168
5344
  * const fWorkbook = univerAPI.getActiveWorkbook();
5169
- * const fWorksheet = fWorkbook.getActiveSheet();
5345
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5346
+ * if (!fWorksheet) return;
5170
5347
  * const fRange = fWorksheet.getRange('A1:B2');
5171
5348
  * fRange.setTextRotation(45);
5172
5349
  * ```
@@ -5186,7 +5363,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5186
5363
  * @returns {FRange} This range, for chaining
5187
5364
  * ```ts
5188
5365
  * const fWorkbook = univerAPI.getActiveWorkbook();
5189
- * const fWorksheet = fWorkbook.getActiveSheet();
5366
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5367
+ * if (!fWorksheet) return;
5190
5368
  * const fRange = fWorksheet.getRange('B2');
5191
5369
  * fRange.setValue(123);
5192
5370
  *
@@ -5211,7 +5389,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5211
5389
  * @returns {FRange} This range, for chaining
5212
5390
  * ```ts
5213
5391
  * const fWorkbook = univerAPI.getActiveWorkbook();
5214
- * const fWorksheet = fWorkbook.getActiveSheet();
5392
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5393
+ * if (!fWorksheet) return;
5215
5394
  * const fRange = fWorksheet.getRange('A1:B2');
5216
5395
  * fRange.setValueForCell(123);
5217
5396
  *
@@ -5242,7 +5421,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5242
5421
  * @example
5243
5422
  * ```
5244
5423
  * const fWorkbook = univerAPI.getActiveWorkbook();
5245
- * const fWorksheet = fWorkbook.getActiveSheet();
5424
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5425
+ * if (!fWorksheet) return;
5246
5426
  * const fRange = fWorksheet.getRange('A1:B2');
5247
5427
  * console.log(fRange.getValue(true));
5248
5428
  *
@@ -5278,7 +5458,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5278
5458
  * @example
5279
5459
  * ```ts
5280
5460
  * const fWorkbook = univerAPI.getActiveWorkbook();
5281
- * const fWorksheet = fWorkbook.getActiveSheet();
5461
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5462
+ * if (!fWorksheet) return;
5282
5463
  * const fRange = fWorksheet.getRange('A1:B2');
5283
5464
  * console.log(fRange.getValue(true));
5284
5465
  *
@@ -5313,7 +5494,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5313
5494
  * @example
5314
5495
  * ```ts
5315
5496
  * const fWorkbook = univerAPI.getActiveWorkbook();
5316
- * const fWorksheet = fWorkbook.getActiveSheet();
5497
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5498
+ * if (!fWorksheet) return;
5317
5499
  * const fRange = fWorksheet.getRange('A1:B2');
5318
5500
  * fRange.setWrap(true);
5319
5501
  * console.log(fRange.getWrap());
@@ -5335,7 +5517,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5335
5517
  * @example
5336
5518
  * ```ts
5337
5519
  * const fWorkbook = univerAPI.getActiveWorkbook();
5338
- * const fWorksheet = fWorkbook.getActiveSheet();
5520
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5521
+ * if (!fWorksheet) return;
5339
5522
  * const fRange = fWorksheet.getRange('A1:B2');
5340
5523
  * fRange.setWrapStrategy(univerAPI.Enum.WrapStrategy.WRAP);
5341
5524
  * console.log(fRange.getWrapStrategy());
@@ -5357,7 +5540,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5357
5540
  * @example
5358
5541
  * ```ts
5359
5542
  * const fWorkbook = univerAPI.getActiveWorkbook();
5360
- * const fWorksheet = fWorkbook.getActiveSheet();
5543
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5544
+ * if (!fWorksheet) return;
5361
5545
  * const fRange = fWorksheet.getRange('A1:B2');
5362
5546
  * fRange.setVerticalAlignment('top');
5363
5547
  * ```
@@ -5378,7 +5562,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5378
5562
  * @example
5379
5563
  * ```ts
5380
5564
  * const fWorkbook = univerAPI.getActiveWorkbook();
5381
- * const fWorksheet = fWorkbook.getActiveSheet();
5565
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5566
+ * if (!fWorksheet) return;
5382
5567
  * const fRange = fWorksheet.getRange('A1:B2');
5383
5568
  * fRange.setHorizontalAlignment('left');
5384
5569
  * ```
@@ -5399,7 +5584,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5399
5584
  * @example
5400
5585
  * ```ts
5401
5586
  * const fWorkbook = univerAPI.getActiveWorkbook();
5402
- * const fWorksheet = fWorkbook.getActiveSheet();
5587
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5588
+ * if (!fWorksheet) return;
5403
5589
  * const fRange = fWorksheet.getRange('A1:B2');
5404
5590
  * fRange.setValues([
5405
5591
  * [1, { v: 2, s: { bg: { rgb: '#ff0000' } } }],
@@ -5424,7 +5610,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5424
5610
  * @example
5425
5611
  * ```ts
5426
5612
  * const fWorkbook = univerAPI.getActiveWorkbook();
5427
- * const fWorksheet = fWorkbook.getActiveSheet();
5613
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5614
+ * if (!fWorksheet) return;
5428
5615
  * const fRange = fWorksheet.getRange('A1:B2');
5429
5616
  * fRange.setFontWeight('bold');
5430
5617
  * ```
@@ -5455,7 +5642,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5455
5642
  * @example
5456
5643
  * ```ts
5457
5644
  * const fWorkbook = univerAPI.getActiveWorkbook();
5458
- * const fWorksheet = fWorkbook.getActiveSheet();
5645
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5646
+ * if (!fWorksheet) return;
5459
5647
  * const fRange = fWorksheet.getRange('A1:B2');
5460
5648
  * fRange.setFontStyle('italic');
5461
5649
  * ```
@@ -5486,7 +5674,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5486
5674
  * @example
5487
5675
  * ```ts
5488
5676
  * const fWorkbook = univerAPI.getActiveWorkbook();
5489
- * const fWorksheet = fWorkbook.getActiveSheet();
5677
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5678
+ * if (!fWorksheet) return;
5490
5679
  * const fRange = fWorksheet.getRange('A1:B2');
5491
5680
  * fRange.setFontLine('underline');
5492
5681
  * ```
@@ -5546,7 +5735,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5546
5735
  * @example
5547
5736
  * ```ts
5548
5737
  * const fWorkbook = univerAPI.getActiveWorkbook();
5549
- * const fWorksheet = fWorkbook.getActiveSheet();
5738
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5739
+ * if (!fWorksheet) return;
5550
5740
  * const fRange = fWorksheet.getRange('A1:B2');
5551
5741
  * fRange.setFontFamily('Arial');
5552
5742
  * ```
@@ -5572,7 +5762,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5572
5762
  * @example
5573
5763
  * ```ts
5574
5764
  * const fWorkbook = univerAPI.getActiveWorkbook();
5575
- * const fWorksheet = fWorkbook.getActiveSheet();
5765
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5766
+ * if (!fWorksheet) return;
5576
5767
  * const fRange = fWorksheet.getRange('A1:B2');
5577
5768
  * fRange.setFontSize(24);
5578
5769
  * ```
@@ -5598,7 +5789,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5598
5789
  * @example
5599
5790
  * ```ts
5600
5791
  * const fWorkbook = univerAPI.getActiveWorkbook();
5601
- * const fWorksheet = fWorkbook.getActiveSheet();
5792
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5793
+ * if (!fWorksheet) return;
5602
5794
  * const fRange = fWorksheet.getRange('A1:B2');
5603
5795
  * fRange.setFontColor('#ff0000');
5604
5796
  * ```
@@ -5626,7 +5818,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5626
5818
  * @example
5627
5819
  * ```ts
5628
5820
  * const fWorkbook = univerAPI.getActiveWorkbook();
5629
- * const fWorksheet = fWorkbook.getActiveSheet();
5821
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5822
+ * if (!fWorksheet) return;
5630
5823
  * const fRange = fWorksheet.getRange('A1:B2');
5631
5824
  * fRange.merge();
5632
5825
  * console.log(fRange.isMerged());
@@ -5634,7 +5827,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5634
5827
  *
5635
5828
  * ```ts
5636
5829
  * const fWorkbook = univerAPI.getActiveWorkbook();
5637
- * const fWorksheet = fWorkbook.getActiveSheet();
5830
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5831
+ * if (!fWorksheet) return;
5638
5832
  * const fRange = fWorksheet.getRange('B1:C2');
5639
5833
  * // Assume A1:B2 is already merged.
5640
5834
  * fRange.merge({ isForceMerge: true });
@@ -5656,7 +5850,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5656
5850
  * ```ts
5657
5851
  * // Assume the active sheet is a new sheet with no merged cells.
5658
5852
  * const fWorkbook = univerAPI.getActiveWorkbook();
5659
- * const fWorksheet = fWorkbook.getActiveSheet();
5853
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5854
+ * if (!fWorksheet) return;
5660
5855
  * const fRange = fWorksheet.getRange('A1:B2');
5661
5856
  * fRange.mergeAcross();
5662
5857
  * // There will be two merged cells. A1:B1 and A2:B2.
@@ -5668,7 +5863,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5668
5863
  *
5669
5864
  * ```ts
5670
5865
  * const fWorkbook = univerAPI.getActiveWorkbook();
5671
- * const fWorksheet = fWorkbook.getActiveSheet();
5866
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5867
+ * if (!fWorksheet) return;
5672
5868
  * const fRange = fWorksheet.getRange('B1:C2');
5673
5869
  * // Assume A1:B2 is already merged.
5674
5870
  * fRange.mergeAcross({ isForceMerge: true });
@@ -5691,7 +5887,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5691
5887
  * ```ts
5692
5888
  * // Assume the active sheet is a new sheet with no merged cells.
5693
5889
  * const fWorkbook = univerAPI.getActiveWorkbook();
5694
- * const fWorksheet = fWorkbook.getActiveSheet();
5890
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5891
+ * if (!fWorksheet) return;
5695
5892
  * const fRange = fWorksheet.getRange('A1:B2');
5696
5893
  * fRange.mergeVertically();
5697
5894
  * // There will be two merged cells. A1:A2 and B1:B2.
@@ -5703,7 +5900,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5703
5900
  *
5704
5901
  * ```ts
5705
5902
  * const fWorkbook = univerAPI.getActiveWorkbook();
5706
- * const fWorksheet = fWorkbook.getActiveSheet();
5903
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5904
+ * if (!fWorksheet) return;
5707
5905
  * const fRange = fWorksheet.getRange('B1:C2');
5708
5906
  * // Assume A1:B2 is already merged.
5709
5907
  * fRange.mergeVertically({ isForceMerge: true });
@@ -5722,7 +5920,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5722
5920
  * @example
5723
5921
  * ```ts
5724
5922
  * const fWorkbook = univerAPI.getActiveWorkbook();
5725
- * const fWorksheet = fWorkbook.getActiveSheet();
5923
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5924
+ * if (!fWorksheet) return;
5726
5925
  * const fRange = fWorksheet.getRange('A1:B2');
5727
5926
  * fRange.merge();
5728
5927
  * const anchor = fWorksheet.getRange('A1');
@@ -5739,7 +5938,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5739
5938
  * @example
5740
5939
  * ```ts
5741
5940
  * const fWorkbook = univerAPI.getActiveWorkbook();
5742
- * const fWorksheet = fWorkbook.getActiveSheet();
5941
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5942
+ * if (!fWorksheet) return;
5743
5943
  * const fRange = fWorksheet.getRange('A1:B2');
5744
5944
  * fRange.merge();
5745
5945
  * const anchor = fWorksheet.getRange('A1');
@@ -5764,7 +5964,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5764
5964
  * @param {ICellData} callback.cell the cell data
5765
5965
  * ```ts
5766
5966
  * const fWorkbook = univerAPI.getActiveWorkbook();
5767
- * const fWorksheet = fWorkbook.getActiveSheet();
5967
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5968
+ * if (!fWorksheet) return;
5768
5969
  * const fRange = fWorksheet.getRange('A1:B2');
5769
5970
  * fRange.forEach((row, col, cell) => {
5770
5971
  * console.log(row, col, cell);
@@ -5785,7 +5986,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5785
5986
  * @returns {string} The A1 notation of the range.
5786
5987
  * ```ts
5787
5988
  * const fWorkbook = univerAPI.getActiveWorkbook();
5788
- * const fWorksheet = fWorkbook.getActiveSheet();
5989
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
5990
+ * if (!fWorksheet) return;
5789
5991
  *
5790
5992
  * // By default, the A1 notation is returned without the sheet name and without absolute reference types.
5791
5993
  * const fRange = fWorksheet.getRange('A1:B2');
@@ -5823,7 +6025,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5823
6025
  * @example
5824
6026
  * ```ts
5825
6027
  * const fWorkbook = univerAPI.getActiveWorkbook();
5826
- * const fWorksheet = fWorkbook.getActiveSheet();
6028
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
6029
+ * if (!fWorksheet) return;
5827
6030
  * const fRange = fWorksheet.getRange('A1:B2');
5828
6031
  * fRange.activate(); // the active cell will be A1
5829
6032
  * ```
@@ -5841,7 +6044,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5841
6044
  * @example
5842
6045
  * ```ts
5843
6046
  * const fWorkbook = univerAPI.getActiveWorkbook();
5844
- * const fWorksheet = fWorkbook.getActiveSheet();
6047
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
6048
+ * if (!fWorksheet) return;
5845
6049
  *
5846
6050
  * // Set the range A1:B2 as the active range, default active cell is A1
5847
6051
  * const fRange = fWorksheet.getRange('A1:B2');
@@ -5893,7 +6097,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5893
6097
  * @example Show how to split text to columns with custom delimiter
5894
6098
  * ```ts
5895
6099
  * const fWorkbook = univerAPI.getActiveWorkbook();
5896
- * const fWorksheet = fWorkbook.getActiveSheet();
6100
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
6101
+ * if (!fWorksheet) return;
5897
6102
  *
5898
6103
  * // A1:A3 has following values:
5899
6104
  * // A |
@@ -5935,7 +6140,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5935
6140
  * @example
5936
6141
  * ```ts
5937
6142
  * const fWorkbook = univerAPI.getActiveWorkbook();
5938
- * const fWorksheet = fWorkbook.getActiveSheet();
6143
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
6144
+ * if (!fWorksheet) return;
5939
6145
  * const fRange = fWorksheet.getRange('A1:E20');
5940
6146
  * fRange.useThemeStyle('default');
5941
6147
  * ```
@@ -5957,7 +6163,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5957
6163
  * @example
5958
6164
  * ```ts
5959
6165
  * const fWorkbook = univerAPI.getActiveWorkbook();
5960
- * const fWorksheet = fWorkbook.getActiveSheet();
6166
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
6167
+ * if (!fWorksheet) return;
5961
6168
  * const fRange = fWorksheet.getRange('A1:E20');
5962
6169
  * fRange.removeThemeStyle('default');
5963
6170
  * ```
@@ -5976,7 +6183,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5976
6183
  * @example
5977
6184
  * ```ts
5978
6185
  * const fWorkbook = univerAPI.getActiveWorkbook();
5979
- * const fWorksheet = fWorkbook.getActiveSheet();
6186
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
6187
+ * if (!fWorksheet) return;
5980
6188
  * const fRange = fWorksheet.getRange('A1:E20');
5981
6189
  * console.log(fRange.getUsedThemeStyle()); // undefined
5982
6190
  * fRange.useThemeStyle('default');
@@ -5999,7 +6207,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5999
6207
  * @example
6000
6208
  * ```ts
6001
6209
  * const fWorkbook = univerAPI.getActiveWorkbook();
6002
- * const fWorkSheet = fWorkbook.getActiveSheet();
6210
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
6211
+ * if (!fWorkSheet) return;
6003
6212
  * const fRange = fWorkSheet.getRange('A1:D10');
6004
6213
  *
6005
6214
  * // clear the content and format of the range A1:D10
@@ -6026,7 +6235,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
6026
6235
  * @example
6027
6236
  * ```typescript
6028
6237
  * const fWorkbook = univerAPI.getActiveWorkbook();
6029
- * const fWorkSheet = fWorkbook.getActiveSheet();
6238
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
6239
+ * if (!fWorkSheet) return;
6030
6240
  * const fRange = fWorkSheet.getRange('A1:D10');
6031
6241
  *
6032
6242
  * // clear the content only of the range A1:D10
@@ -6047,7 +6257,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
6047
6257
  * @example
6048
6258
  * ```typescript
6049
6259
  * const fWorkbook = univerAPI.getActiveWorkbook();
6050
- * const fWorkSheet = fWorkbook.getActiveSheet();
6260
+ * const fWorkSheet = fWorkbook.getSheetByName('Sheet1');
6261
+ * if (!fWorkSheet) return;
6051
6262
  * const fRange = fWorkSheet.getRange('A1:D10');
6052
6263
  * // clear the format only of the range A1:D10
6053
6264
  * fRange.clearFormat();
@@ -6068,7 +6279,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
6068
6279
  * ```ts
6069
6280
  * // Assume the active sheet empty sheet.
6070
6281
  * const fWorkbook = univerAPI.getActiveWorkbook();
6071
- * const fWorksheet = fWorkbook.getActiveSheet();
6282
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
6283
+ * if (!fWorksheet) return;
6072
6284
  * const values = [
6073
6285
  * [1, 2, 3, 4],
6074
6286
  * [2, 3, 4, 5],
@@ -6127,7 +6339,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
6127
6339
  * ```ts
6128
6340
  * // Assume the active sheet empty sheet.
6129
6341
  * const fWorkbook = univerAPI.getActiveWorkbook();
6130
- * const fWorksheet = fWorkbook.getActiveSheet();
6342
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
6343
+ * if (!fWorksheet) return;
6131
6344
  * const values = [
6132
6345
  * [1, 2, 3, 4],
6133
6346
  * [2, 3, 4, 5],
@@ -6190,7 +6403,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
6190
6403
  * ```ts
6191
6404
  * // Assume the active sheet is a new sheet with no data.
6192
6405
  * const fWorkbook = univerAPI.getActiveWorkbook();
6193
- * const fWorksheet = fWorkbook.getActiveSheet();
6406
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
6407
+ * if (!fWorksheet) return;
6194
6408
  *
6195
6409
  * // Set the range A1:D4 with some values, the range A1:D4 will be:
6196
6410
  * // | | |
@@ -6260,7 +6474,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
6260
6474
  * ```ts
6261
6475
  * // Assume the active sheet is a new sheet with no data.
6262
6476
  * const fWorkbook = univerAPI.getActiveWorkbook();
6263
- * const fWorksheet = fWorkbook.getActiveSheet();
6477
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
6478
+ * if (!fWorksheet) return;
6264
6479
  * const fRange = fWorksheet.getRange('A1:B2');
6265
6480
  * console.log(fRange.isBlank()); // true
6266
6481
  *
@@ -6292,7 +6507,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
6292
6507
  * @example
6293
6508
  * ```ts
6294
6509
  * const fWorkbook = univerAPI.getActiveWorkbook();
6295
- * const fWorksheet = fWorkbook.getActiveSheet();
6510
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
6511
+ * if (!fWorksheet) return;
6296
6512
  * const fRange = fWorksheet.getRange('A1:B2');
6297
6513
  * console.log(fRange.getA1Notation()); // A1:B2
6298
6514
  *
@@ -6322,7 +6538,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
6322
6538
  * @example
6323
6539
  * ```ts
6324
6540
  * const fWorkbook = univerAPI.getActiveWorkbook();
6325
- * const fWorksheet = fWorkbook.getActiveSheet();
6541
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
6542
+ * if (!fWorksheet) return;
6326
6543
  * const fRange = fWorksheet.getRange('A1');
6327
6544
  * fRange.setFormula('=SUM(A2:A5)');
6328
6545
  * console.log(fRange.getFormula()); // '=SUM(A2:A5)'
@@ -6338,7 +6555,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
6338
6555
  * @example
6339
6556
  * ```ts
6340
6557
  * const fWorkbook = univerAPI.getActiveWorkbook();
6341
- * const fWorksheet = fWorkbook.getActiveSheet();
6558
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
6559
+ * if (!fWorksheet) return;
6342
6560
  * const fRange = fWorksheet.getRange('A1:B2');
6343
6561
  * fRange.setFormulas([
6344
6562
  * ['=SUM(A2:A5)', '=SUM(B2:B5)'],
@@ -6356,7 +6574,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
6356
6574
  * @returns {FRangePermission} - The RangePermission instance.
6357
6575
  * @example
6358
6576
  * ```ts
6359
- * const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet();
6577
+ * const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
6578
+ * if (!fWorksheet) return;
6360
6579
  * const fRange = fWorksheet.getRange('A1:B10');
6361
6580
  * const permission = fRange.getRangePermission();
6362
6581
  *
@@ -6391,7 +6610,8 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
6391
6610
  * ```ts
6392
6611
  * // Auto-fill the range D1:D10 based on the data in the range C1:C2
6393
6612
  * const fWorkbook = univerAPI.getActiveWorkbook();
6394
- * const fWorksheet = fWorkbook.getActiveSheet();
6613
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
6614
+ * if (!fWorksheet) return;
6395
6615
  * const fRange = fWorksheet.getRange('A1:A4');
6396
6616
  *
6397
6617
  * // Auto-fill without specifying applyType (default behavior)
@@ -6894,6 +7114,7 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
6894
7114
  * // The code below gets the active sheet of the workbook
6895
7115
  * const fWorkbook = univerAPI.getActiveWorkbook();
6896
7116
  * const fWorksheet = fWorkbook.getActiveSheet();
7117
+ * if (!fWorksheet) return;
6897
7118
  * console.log(fWorksheet);
6898
7119
  * ```
6899
7120
  */
@@ -7238,7 +7459,9 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
7238
7459
  * @example
7239
7460
  * ```ts
7240
7461
  * const fWorkbook = univerAPI.getActiveWorkbook();
7241
- * const range = fWorkbook.getActiveSheet().getRange('A10:B10');
7462
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
7463
+ * if (!fWorksheet) return;
7464
+ * const range = fWorksheet.getRange('A10:B10');
7242
7465
  * fWorkbook.setActiveRange(range);
7243
7466
  * ```
7244
7467
  */
@@ -7316,7 +7539,8 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
7316
7539
  * ```ts
7317
7540
  * // The code below duplicates the given worksheet
7318
7541
  * const fWorkbook = univerAPI.getActiveWorkbook();
7319
- * const activeSheet = fWorkbook.getActiveSheet();
7542
+ * const activeSheet = fWorkbook.getSheetByName('Sheet1');
7543
+ * if (!activeSheet) return;
7320
7544
  * const duplicatedSheet = fWorkbook.duplicateSheet(activeSheet);
7321
7545
  * console.log(duplicatedSheet);
7322
7546
  * ```
@@ -7414,7 +7638,8 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
7414
7638
  * ```ts
7415
7639
  * // The code below moves the sheet to the specified index
7416
7640
  * const fWorkbook = univerAPI.getActiveWorkbook();
7417
- * const sheet = fWorkbook.getActiveSheet();
7641
+ * const sheet = fWorkbook.getSheetByName('Sheet1');
7642
+ * if (!sheet) return;
7418
7643
  * fWorkbook.moveSheet(sheet, 1);
7419
7644
  * ```
7420
7645
  */
@@ -7735,7 +7960,8 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
7735
7960
  * fWorkbook.addStyles(styles);
7736
7961
  *
7737
7962
  * // Set values with the new styles
7738
- * const fWorksheet = fWorkbook.getActiveSheet();
7963
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
7964
+ * if (!fWorksheet) return;
7739
7965
  * const fRange = fWorksheet.getRange('A1:B2');
7740
7966
  * fRange.setValues([
7741
7967
  * [{ v: 'Hello', s: 'custom-style-1' }, { v: 'Univer', s: 'custom-style-1' }],
@@ -7770,7 +7996,8 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
7770
7996
  * fWorkbook.addStyles(styles);
7771
7997
  *
7772
7998
  * // Set values with the new styles
7773
- * const fWorksheet = fWorkbook.getActiveSheet();
7999
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
8000
+ * if (!fWorksheet) return;
7774
8001
  * const fRange = fWorksheet.getRange('A1:B2');
7775
8002
  * fRange.setValues([
7776
8003
  * [{ v: 'Hello', s: 'custom-style-1' }, { v: 'Univer', s: 'custom-style-1' }],