Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

docs: guide agents to batch facade APIs (#8173)

白熱5a06a7842c8e
diff --git a/packages/sheets-data-validation/src/facade/f-range.ts b/packages/sheets-data-validation/src/facade/f-range.ts
index 0ad1269595..dc25f605d9 100644
--- a/packages/sheets-data-validation/src/facade/f-range.ts
+++ b/packages/sheets-data-validation/src/facade/f-range.ts
@@ -16,7 +16,6 @@
import type { IDataValidationRule, IRange, Nullable } from '@univerjs/core';
import type { IAddSheetDataValidationCommandParams, IClearRangeDataValidationCommandParams } from '@univerjs/sheets-data-validation';
-import type { IDataValidationError } from './f-workbook';
import { DataValidationStatus } from '@univerjs/core';
import {
AddSheetDataValidationCommand,
@@ -26,6 +25,7 @@ import {
SheetsDataValidationValidatorService,
} from '@univerjs/sheets-data-validation';
import { FRange } from '@univerjs/sheets/facade';
+import type { IDataValidationError } from './f-workbook';
import { FDataValidation } from './f-data-validation';
/**
@@ -34,6 +34,10 @@ import { FDataValidation } from './f-data-validation';
export interface IFRangeSheetsDataValidationMixin {
/**
* Set a data validation rule to current range. if rule is null, clear data validation rule.
+ *
+ * To apply or clear the same rule for multiple cells, call this method once on the full target range
+ * instead of calling it on each cell separately.
+ *
* @param {Nullable<FDataValidation>} rule data validation rule, built by `univerAPI.newDataValidation()`
* @returns current range
* @example
diff --git a/packages/sheets-drawing-ui/src/facade/f-worksheet.ts b/packages/sheets-drawing-ui/src/facade/f-worksheet.ts
index b2f12d5aa4..47ac280a2f 100644
--- a/packages/sheets-drawing-ui/src/facade/f-worksheet.ts
+++ b/packages/sheets-drawing-ui/src/facade/f-worksheet.ts
@@ -19,7 +19,6 @@ import type { ISheetFloatDom } from '@univerjs/sheets-drawing';
import type { ICanvasFloatDom, ICanvasFloatDomInfo, IDOMAnchor } from '@univerjs/sheets-drawing-ui';
import type { IFComponentKey } from '@univerjs/sheets-ui/facade';
import type { FRange } from '@univerjs/sheets/facade';
-import type { ISaveCellImagesOptions } from './f-range';
import { SheetSkeletonService } from '@univerjs/sheets';
import {
ISheetDrawingService,
@@ -31,6 +30,7 @@ import { FileNamePart, IBatchSaveImagesService, SheetCanvasFloatDomManagerServic
import { transformComponentKey } from '@univerjs/sheets-ui/facade';
import { FWorksheet } from '@univerjs/sheets/facade';
import { ComponentManager } from '@univerjs/ui';
+import type { ISaveCellImagesOptions } from './f-range';
// why omit this key? if componentKey is missing, then which component should be used?
export interface IFICanvasFloatDom extends Omit<ICanvasFloatDom, 'componentKey' | 'unitId' | 'subUnitId'>, IFComponentKey { }
@@ -82,6 +82,10 @@ export interface IFWorksheetDrawingUIMixin {
/**
* Update float dom position and properties
+ *
+ * For multiple floating DOM elements on this worksheet, prefer {@link FWorksheet.batchUpdateFloatDoms}
+ * with an array of `{ id, config }` updates instead of calling this method in a loop.
+ *
* @param {string} id - float dom id
* @param {Partial<IFCanvasFloatDomResult>} config - new float dom config
* @returns {FWorksheet} The worksheet instance for chaining
diff --git a/packages/sheets-drawing/src/facade/f-over-grid-image.ts b/packages/sheets-drawing/src/facade/f-over-grid-image.ts
index efe8540bb8..9c9f900e1f 100644
--- a/packages/sheets-drawing/src/facade/f-over-grid-image.ts
+++ b/packages/sheets-drawing/src/facade/f-over-grid-image.ts
@@ -1009,6 +1009,10 @@ export class FOverGridImage extends FBase {
/**
* Remove the image from the sheet
+ *
+ * For multiple images on the same worksheet, prefer {@link FWorksheet.deleteImages} with the image
+ * handles instead of calling this method on each image.
+ *
* @returns {boolean} true if the image is removed successfully, otherwise false
* @example
* ```ts
diff --git a/packages/sheets-drawing/src/facade/f-worksheet.ts b/packages/sheets-drawing/src/facade/f-worksheet.ts
index 97cb636f8f..023bffbbb6 100644
--- a/packages/sheets-drawing/src/facade/f-worksheet.ts
+++ b/packages/sheets-drawing/src/facade/f-worksheet.ts
@@ -69,6 +69,11 @@ export interface IFWorksheetDrawingMixin {
/**
* Insert an image to the sheet
+ *
+ * For multiple images, prefer {@link FWorksheet.insertImages} instead of repeated insertions.
+ * Prepare each ISheetImage with {@link FWorksheet.newOverGridImage} and `buildAsync()`, then pass
+ * the complete array to `insertImages()`; it accepts image data, not URLs or blobs.
+ *
* @param {string} url - The image url
* @returns {Promise<boolean>} true if the image is inserted successfully
* @example
@@ -82,6 +87,10 @@ export interface IFWorksheetDrawingMixin {
*/
insertImage(url: string): Promise<boolean>;
/**
+ * For multiple images, prefer {@link FWorksheet.insertImages} instead of repeated insertions.
+ * Prepare each ISheetImage with {@link FWorksheet.newOverGridImage} and `buildAsync()`, then pass
+ * the complete array to `insertImages()`; it accepts image data, not URLs or blobs.
+ *
* @param {string} url - The image url
* @param {number} column - The column index to insert the image
* @param {number} row - The row index to insert the image
@@ -97,6 +106,10 @@ export interface IFWorksheetDrawingMixin {
*/
insertImage(url: string, column: number, row: number): Promise<boolean>;
/**
+ * For multiple images, prefer {@link FWorksheet.insertImages} instead of repeated insertions.
+ * Prepare each ISheetImage with {@link FWorksheet.newOverGridImage} and `buildAsync()`, then pass
+ * the complete array to `insertImages()`; it accepts image data, not URLs or blobs.
+ *
* @param {string} url - The image url
* @param {number} column - The column index to insert the image
* @param {number} row - The row index to insert the image
diff --git a/packages/sheets-numfmt/src/facade/f-range.ts b/packages/sheets-numfmt/src/facade/f-range.ts
index 8170cbf601..043f74068c 100644
--- a/packages/sheets-numfmt/src/facade/f-range.ts
+++ b/packages/sheets-numfmt/src/facade/f-range.ts
@@ -26,6 +26,11 @@ export interface IFRangeSheetsNumfmtMixin {
/**
* Set the number format of the range.
+ *
+ * For the same format across multiple cells, call this method once on the entire target range.
+ * For different formats per cell, prefer {@link FRange.setNumberFormats} with a two-dimensional array
+ * matching the range dimensions instead of calling this method for each cell.
+ *
* @param {string} pattern - The number format pattern.
* @returns {FRange} The FRange instance for chaining.
* @example
@@ -68,6 +73,10 @@ export interface IFRangeSheetsNumfmtMixin {
/**
* Get the number formatting of the top-left cell of the given range. Returns an empty string when no number format is set, even if the cell contains a value.
+ *
+ * For multiple cells, call {@link FRange.getNumberFormats} once on the full target range
+ * instead of calling this method for each cell.
+ *
* @returns {string} The number format of the top-left cell of the range.
* @example
* ```ts
diff --git a/packages/sheets-sort/src/facade/f-range.ts b/packages/sheets-sort/src/facade/f-range.ts
index 8a1007a152..74a36fcd3b 100644
--- a/packages/sheets-sort/src/facade/f-range.ts
+++ b/packages/sheets-sort/src/facade/f-range.ts
@@ -26,6 +26,10 @@ export type SortColumnSpec = { column: number; ascending: boolean } | number;
export interface IFRangeSheetsSortMixin {
/**
* Sorts the cells in the given range, by column(s) and order specified.
+ *
+ * To sort by multiple columns, pass all sort specifications in priority order in one array and call
+ * this method once on the full target range. Repeated single-column sorts can change the intended priority.
+ *
* @param {SortColumnSpec | SortColumnSpec[]} column The column index with order or an array of column indexes with order. The range first column index is 0.
* @returns {FRange} The range itself for chaining.
* @example
diff --git a/packages/sheets-ui/src/facade/f-worksheet.ts b/packages/sheets-ui/src/facade/f-worksheet.ts
index e2ad8b17a9..568180a65d 100644
--- a/packages/sheets-ui/src/facade/f-worksheet.ts
+++ b/packages/sheets-ui/src/facade/f-worksheet.ts
@@ -207,6 +207,10 @@ export interface IFWorksheetUIMixin {
/**
* Sets the width of all columns starting at the given column position to fit their contents.
+ *
+ * To resize multiple consecutive columns, pass the full `numColumns` in one call
+ * instead of repeatedly calling this method with the default count of one.
+ *
* @param {number} startColumn - The position of the first column to resize. index starts at 0.
* @param {number} [numColumns] - The number of columns to auto-resize. Default is 1.
* @returns {FWorksheet} - The FWorksheet instance for chaining.
@@ -224,6 +228,10 @@ export interface IFWorksheetUIMixin {
/**
* Sets the height of all rows starting at the given row position to fit their contents.
+ *
+ * To resize multiple consecutive rows, pass the full `numRows` in one call
+ * instead of repeatedly calling this method with the default count of one.
+ *
* @param {number} startRow - The position of the first row to resize. index starts at 0.
* @param {number} [numRows] - The number of rows to auto-resize. Default is 1.
* @returns {FWorksheet} - The FWorksheet instance for chaining.
diff --git a/packages/sheets/src/facade/f-range.ts b/packages/sheets/src/facade/f-range.ts
index 1e3561d1e5..9fcc28e648 100644
--- a/packages/sheets/src/facade/f-range.ts
+++ b/packages/sheets/src/facade/f-range.ts
@@ -419,6 +419,9 @@ export class FRange extends FBaseInitialable {
/**
* Return first cell style in this range.
*
+ * For multiple cells, create the target range with {@link FWorksheet.getRange} and call
+ * {@link FRange.getCellStyles} once instead of calling this method for each cell.
+ *
* @param {GetStyleType} [type] - The type of the style to get. 'row' means get the composed style of row, col and
* default worksheet style. 'col' means get the composed style of col, row and default worksheet style.
* 'cell' means get the style of cell without merging row style, col style and default worksheet style.
@@ -472,6 +475,10 @@ export class FRange extends FBaseInitialable {
/**
* Return first cell value in this range
+ *
+ * For multiple cells, create the target range with {@link FWorksheet.getRange} and call
+ * {@link FRange.getValues} once instead of calling this method for each cell.
+ *
* @returns {CellValue | null} The cell value
* @example
* ```ts
@@ -489,6 +496,10 @@ export class FRange extends FBaseInitialable {
getValue(): CellValue | null;
/**
* Return first cell value in this range
+ *
+ * For multiple cells, create the target range with {@link FWorksheet.getRange} and call
+ * {@link FRange.getValues} once instead of calling this method for each cell.
+ *
* @param {true} includeRichText Pass `true` to return a `RichTextValue` for rich-text content instead of plain text.
* @returns {CellValue | RichTextValue | null} The cell value
* @example
@@ -519,6 +530,10 @@ export class FRange extends FBaseInitialable {
/**
* Returns the raw value of the top-left cell in the range. Empty cells return `null`.
+ *
+ * For multiple cells, create the target range with {@link FWorksheet.getRange} and call
+ * {@link FRange.getRawValues} once instead of calling this method for each cell.
+ *
* @returns {Nullable<CellValue>} The raw value of the cell. Returns `null` if the cell is empty.
* @example
* ```ts
@@ -544,6 +559,10 @@ export class FRange extends FBaseInitialable {
/**
* Returns the displayed value of the top-left cell in the range. The value is a String. Empty cells return an empty string.
+ *
+ * For multiple cells, create the target range with {@link FWorksheet.getRange} and call
+ * {@link FRange.getDisplayValues} once instead of calling this method for each cell.
+ *
* @returns {string} The displayed value of the cell. Returns an empty string if the cell is empty.
* @example
* ```ts
@@ -743,6 +762,10 @@ export class FRange extends FBaseInitialable {
/**
* Return first cell model data in this range
+ *
+ * For multiple cells, create the target range with {@link FWorksheet.getRange} and call
+ * {@link FRange.getCellDataGrid} once instead of calling this method for each cell.
+ *
* @returns {ICellData | null} The cell model data
* @example
* ```ts
@@ -879,6 +902,10 @@ export class FRange extends FBaseInitialable {
/**
* Returns the formula (A1 notation) of the top-left cell in the range, or an empty string if the cell is empty or doesn't contain a formula.
+ *
+ * For multiple cells, create the target range with {@link FWorksheet.getRange} and call
+ * {@link FRange.getFormulas} once instead of calling this method for each cell.
+ *
* @returns {string} The formula for the cell.
* @example
* ```ts
@@ -933,6 +960,10 @@ export class FRange extends FBaseInitialable {
/**
* Gets whether text wrapping is enabled for top-left cell in the range.
+ *
+ * For multiple cells, create the target range with {@link FWorksheet.getRange} and call
+ * {@link FRange.getWraps} once instead of calling this method for each cell.
+ *
* @returns {boolean} whether text wrapping is enabled for the cell.
* @example
* ```ts
@@ -993,6 +1024,10 @@ export class FRange extends FBaseInitialable {
/**
* Returns the horizontal alignment of the top-left cell as `left`, `center`, or `normal` (right alignment).
* Default and other core alignment values return `general`, which is not accepted by `setHorizontalAlignment()`.
+ *
+ * For multiple cells, create the target range with {@link FWorksheet.getRange} and call
+ * {@link FRange.getHorizontalAlignments} once instead of calling this method for each cell.
+ *
* @returns {string} The horizontal alignment of the text in the cell.
* @example
* ```ts
@@ -1029,6 +1064,10 @@ export class FRange extends FBaseInitialable {
/**
* Returns `top`, `middle`, or `bottom` for the top-left cell; unspecified alignment returns `general`.
* `general` is a getter result and is not accepted by `setVerticalAlignment()`.
+ *
+ * For multiple cells, create the target range with {@link FWorksheet.getRange} and call
+ * {@link FRange.getVerticalAlignments} once instead of calling this method for each cell.
+ *
* @returns {string} The vertical alignment of the text in the cell.
* @example
* ```ts
@@ -1062,7 +1101,12 @@ export class FRange extends FBaseInitialable {
}
/**
- * Set custom meta data for first cell in current range.
+ * Set the same custom metadata for every cell in the current range.
+ *
+ * For the same metadata across multiple cells, call this method once on the entire target range.
+ * For different metadata per cell, prefer {@link FRange.setCustomMetaDatas} with a two-dimensional
+ * array matching the range dimensions instead of calling this method for each cell.
+ *
* @param {CustomData} data The custom meta data
* @returns {FRange} This range, for chaining
* @example
@@ -1126,6 +1170,10 @@ export class FRange extends FBaseInitialable {
/**
* Returns the custom meta data for the cell at the start of this range.
+ *
+ * For multiple cells, create the target range with {@link FWorksheet.getRange} and call
+ * {@link FRange.getCustomMetaDatas} once instead of calling this method for each cell.
+ *
* @returns {CustomData | null} The custom meta data
* @example
* ```ts
@@ -1164,6 +1212,10 @@ export class FRange extends FBaseInitialable {
/**
* Sets basic border properties for the current range.
+ *
+ * For borders on multiple cells, call this method once on the full target range. Border types such as
+ * outer and inner are relative to that range, so applying them to each cell can produce different borders.
+ *
* @param {BorderType} type The type of border to apply
* @param {BorderStyleTypes} style The border style
* @param {string} [color] Optional border color in CSS notation
@@ -1195,6 +1247,10 @@ export class FRange extends FBaseInitialable {
/**
* Returns the background color of the top-left cell in the range.
+ *
+ * For multiple cells, create the target range with {@link FWorksheet.getRange} and call
+ * {@link FRange.getBackgrounds} once instead of calling this method for each cell.
+ *
* @returns {string} The color code of the background.
* @example
* ```ts
@@ -1229,6 +1285,10 @@ export class FRange extends FBaseInitialable {
/**
* Set background color for current range.
+ *
+ * To apply the same setting to multiple cells, create the full target range with {@link FWorksheet.getRange}
+ * and call this method once instead of calling it on each cell separately.
+ *
* @param {string} color The background color
* @returns {FRange} This range, for chaining
* @example
@@ -1257,6 +1317,10 @@ export class FRange extends FBaseInitialable {
/**
* Set background color for current range.
+ *
+ * To apply the same setting to multiple cells, create the full target range with {@link FWorksheet.getRange}
+ * and call this method once instead of calling it on each cell separately.
+ *
* @param {string} color The background color
* @returns {FRange} This range, for chaining
* @example
@@ -1275,6 +1339,10 @@ export class FRange extends FBaseInitialable {
/**
* Set rotation for text in current range.
+ *
+ * To apply the same setting to multiple cells, create the full target range with {@link FWorksheet.getRange}
+ * and call this method once instead of calling it on each cell separately.
+ *
* @param {number} rotation - The rotation angle in degrees
* @returns This range, for chaining
* @example
@@ -1299,6 +1367,10 @@ export class FRange extends FBaseInitialable {
/**
* Sets the value or specified cell properties for every cell in this range.
*
+ * For the same value or cell-data update across multiple cells, call this method once on the entire
+ * target range. For different values or updates per cell, prefer {@link FRange.setValues} with a
+ * two-dimensional array or sparse matrix instead of calling this method for each cell.
+ *
* There are two input modes:
*
* - `CellValue` (`number`, `string`, or `boolean`): replaces the cell content. A string starting
@@ -1370,6 +1442,10 @@ export class FRange extends FBaseInitialable {
/**
* Sets the value or specified cell properties of the top-left cell in this range.
* Uses the same scalar parsing and cell-data update rules as {@link FRange.setValue}.
+ *
+ * For multiple cells, prefer {@link FRange.setValues} on the target range with a two-dimensional array
+ * or sparse matrix. To apply the same value to the entire range, use {@link FRange.setValue} once.
+ *
* @param {CellValue | ICellData} value The scalar content or cell-data update to apply to the top-left cell only.
* @returns {FRange} This range, for chaining
* @example
@@ -1408,6 +1484,10 @@ export class FRange extends FBaseInitialable {
/**
* Set the rich text value for the cell at the start of this range.
+ *
+ * For multiple cells, prefer {@link FRange.setRichTextValues} on the target range with a two-dimensional
+ * array matching its dimensions instead of calling this method for each cell.
+ *
* @param {RichTextValue | IDocumentData} value The rich text value
* @returns {FRange} The range
* @example
@@ -1486,6 +1566,10 @@ export class FRange extends FBaseInitialable {
* Set the cell wrap of the given range.
* Pass `true` to set `WrapStrategy.WRAP`, or `false` to reset to `WrapStrategy.UNSPECIFIED`.
* Use `setWrapStrategy()` to explicitly select clipping or overflow behavior.
+ *
+ * To apply the same setting to multiple cells, create the full target range with {@link FWorksheet.getRange}
+ * and call this method once instead of calling it on each cell separately.
+ *
* @param {boolean} isWrapEnabled Whether to enable wrap
* @returns {FRange} this range, for chaining
* @example
@@ -1511,6 +1595,10 @@ export class FRange extends FBaseInitialable {
/**
* Sets whether cells shrink their font size to fit the cell width.
+ *
+ * To apply the same setting to multiple cells, create the full target range with {@link FWorksheet.getRange}
+ * and call this method once instead of calling it on each cell separately.
+ *
* @param {boolean} enabled Whether to enable shrink-to-fit for this range.
* @returns {FRange} This range, for chaining.
* @example
@@ -1531,6 +1619,10 @@ export class FRange extends FBaseInitialable {
/**
* Sets the text wrapping strategy for the cells in the range.
+ *
+ * To apply the same setting to multiple cells, create the full target range with {@link FWorksheet.getRange}
+ * and call this method once instead of calling it on each cell separately.
+ *
* @param {WrapStrategy} strategy The text wrapping strategy
* @returns {FRange} this range, for chaining
* @example
@@ -1556,6 +1648,10 @@ export class FRange extends FBaseInitialable {
/**
* Set the vertical (top to bottom) alignment for the given range (top/middle/bottom).
+ *
+ * To apply the same setting to multiple cells, create the full target range with {@link FWorksheet.getRange}
+ * and call this method once instead of calling it on each cell separately.
+ *
* @param {FVerticalAlignment} alignment The vertical alignment
* @returns {FRange} this range, for chaining
* @example
@@ -1581,6 +1677,10 @@ export class FRange extends FBaseInitialable {
/**
* Sets the horizontal alignment for the range using `left`, `center`, or `normal`.
* These parameter names follow Google Apps Script. In Univer, `normal` means right alignment; `right` is not accepted.
+ *
+ * To apply the same setting to multiple cells, create the full target range with {@link FWorksheet.getRange}
+ * and call this method once instead of calling it on each cell separately.
+ *
* @param {FHorizontalAlignment} alignment The horizontal alignment: `left`, `center`, or `normal` (right alignment).
* @returns {FRange} this range, for chaining
* @example
@@ -1607,6 +1707,10 @@ export class FRange extends FBaseInitialable {
* Sets cell values or specified cell properties using an array or a sparse matrix.
* Each entry follows the scalar parsing and cell-data update rules of {@link FRange.setValue}.
*
+ * For multiple cells, pass all values or cell-data updates in one call instead of calling this method
+ * on individual cell ranges. Use a matching two-dimensional array for a rectangle, or a sparse matrix
+ * with absolute worksheet coordinates for non-contiguous cells.
+ *
* A two-dimensional array is relative to this range's top-left cell and must match its dimensions.
* A sparse matrix uses absolute, zero-based worksheet row and column keys. Only supplied entries
* are updated; matrix coordinates are not offset by or clipped to this range.
@@ -1651,6 +1755,10 @@ export class FRange extends FBaseInitialable {
/**
* Sets the font weight for the given range (normal/bold),
+ *
+ * To apply the same setting to multiple cells, create the full target range with {@link FWorksheet.getRange}
+ * and call this method once instead of calling it on each cell separately.
+ *
* @param {FontWeight|null} fontWeight The font weight, either 'normal' or 'bold'; a null value resets the font weight.
* @returns {FRange} This range, for chaining
* @example
@@ -1693,6 +1801,10 @@ export class FRange extends FBaseInitialable {
/**
* Sets the font style for the given range ('italic' or 'normal').
+ *
+ * To apply the same setting to multiple cells, create the full target range with {@link FWorksheet.getRange}
+ * and call this method once instead of calling it on each cell separately.
+ *
* @param {FontStyle|null} fontStyle The font style, either 'italic' or 'normal'; a null value resets the font style.
* @returns {FRange} This range, for chaining
* @example
@@ -1735,6 +1847,10 @@ export class FRange extends FBaseInitialable {
/**
* Sets the font line style of the given range ('underline', 'line-through', or 'none').
+ *
+ * To apply the same setting to multiple cells, create the full target range with {@link FWorksheet.getRange}
+ * and call this method once instead of calling it on each cell separately.
+ *
* @param {FontLine|null} fontLine The font line style, either 'underline', 'line-through', or 'none'; a null value resets the font line style.
* @returns {FRange} This range, for chaining
* @example
@@ -1813,6 +1929,10 @@ export class FRange extends FBaseInitialable {
/**
* Sets the font family, such as "Arial" or "Helvetica".
+ *
+ * To apply the same setting to multiple cells, create the full target range with {@link FWorksheet.getRange}
+ * and call this method once instead of calling it on each cell separately.
+ *
* @param {string|null} fontFamily The font family to set; a null value resets the font family.
* @returns {FRange} This range, for chaining
* @example
@@ -1843,6 +1963,10 @@ export class FRange extends FBaseInitialable {
/**
* Sets the font size, with the size being the point size to use.
+ *
+ * To apply the same setting to multiple cells, create the full target range with {@link FWorksheet.getRange}
+ * and call this method once instead of calling it on each cell separately.
+ *
* @param {number|null} size A font size in point size. A null value resets the font size.
* @returns {FRange} This range, for chaining
* @example
@@ -1873,6 +1997,10 @@ export class FRange extends FBaseInitialable {
/**
* Sets the font color in CSS notation (such as '#ffffff' or 'white').
+ *
+ * To apply the same setting to multiple cells, create the full target range with {@link FWorksheet.getRange}
+ * and call this method once instead of calling it on each cell separately.
+ *
* @param {string|null} color The font color in CSS notation (such as '#ffffff' or 'white'); a null value resets the color.
* @returns {FRange} This range, for chaining
* @example
@@ -2416,6 +2544,10 @@ export class FRange extends FBaseInitialable {
/**
* Clears the range content and formatting, or only one of them as specified by the options.
* Both content and formatting are cleared when both flags are true or both are false.
+ *
+ * To clear multiple cells, create the full target range with {@link FWorksheet.getRange} and call this
+ * method once instead of clearing each cell separately.
+ *
* @param {IFacadeClearOptions} [options] - Options for clearing the range. If not provided, the contents and formatting are cleared both.
* @param {boolean} [options.contentsOnly] - If true, the contents of the range are cleared. Effective only when `formatOnly` is false. Defaults to false.
* @param {boolean} [options.formatOnly] - Clears only formatting when true and `contentsOnly` is false. Defaults to false.
@@ -2454,6 +2586,10 @@ export class FRange extends FBaseInitialable {
/**
* Clears content of the range, while preserving formatting information.
+ *
+ * To clear multiple cells, create the full target range with {@link FWorksheet.getRange} and call this
+ * method once instead of clearing each cell separately.
+ *
* @returns {FRange} This range, for chaining.
* @example
* ```typescript
@@ -2477,6 +2613,10 @@ export class FRange extends FBaseInitialable {
/**
* Clears formatting information of the range, while preserving contents.
+ *
+ * To clear multiple cells, create the full target range with {@link FWorksheet.getRange} and call this
+ * method once instead of clearing each cell separately.
+ *
* @returns {FRange} This range, for chaining.
* @example
* ```typescript
@@ -2847,6 +2987,11 @@ export class FRange extends FBaseInitialable {
/**
* Updates the formula for this range. The given formula must be in A1 notation.
+ *
+ * For the same formula string across multiple cells, call this method once on the entire target range.
+ * For different formulas per cell, prefer {@link FRange.setFormulas} with a two-dimensional array
+ * matching the range dimensions instead of calling this method for each cell.
+ *
* @param {string} formula - A string representing the formula to set for the cell.
* @returns {FRange} This range instance for chaining.
* @example
diff --git a/packages/sheets/src/facade/f-worksheet.ts b/packages/sheets/src/facade/f-worksheet.ts
index aacc1aa270..3d1b322c1b 100644
--- a/packages/sheets/src/facade/f-worksheet.ts
+++ b/packages/sheets/src/facade/f-worksheet.ts
@@ -556,6 +556,10 @@ export class FWorksheet extends FBaseInitialable {
/**
* Inserts a row after the given row position.
+ *
+ * To insert multiple rows, prefer {@link FWorksheet.insertRowsAfter} with the full count
+ * instead of repeatedly calling this method.
+ *
* @param {number} afterPosition - The existing row after which the new row should be added. The index is zero-based and must be between 0 and `getMaxRows() - 1`.
* @returns {FWorksheet} This sheet, for chaining.
* @example
@@ -574,6 +578,10 @@ export class FWorksheet extends FBaseInitialable {
/**
* Inserts a row before the given row position.
+ *
+ * To insert multiple rows, prefer {@link FWorksheet.insertRowsBefore} with the full count
+ * instead of repeatedly calling this method.
+ *
* @param {number} beforePosition - The existing row before which the new row should be added. The index is zero-based and must be between 0 and `getMaxRows() - 1`.
* @returns {FWorksheet} This sheet, for chaining.
* @example
@@ -592,6 +600,10 @@ export class FWorksheet extends FBaseInitialable {
/**
* Inserts one or more consecutive blank rows in a sheet starting at the specified location.
+ *
+ * For multiple consecutive rows, pass the full `numRows` in one call instead of looping
+ * with the default count of one.
+ *
* @param {number} rowIndex - The existing row before which rows are inserted. The index is zero-based and must be between 0 and `getMaxRows() - 1`.
* @param {number} [numRows] - The positive number of rows to insert.
* @returns {FWorksheet} This sheet, for chaining.
@@ -704,6 +716,11 @@ export class FWorksheet extends FBaseInitialable {
/**
* Deletes the row at the given row position.
+ *
+ * For consecutive rows, prefer {@link FWorksheet.deleteRows} with the full count. For
+ * non-contiguous rows, use {@link FWorksheet.deleteRowsByPoints} so shifting indices are handled
+ * without a manual loop over this method.
+ *
* @param {number} rowPosition - The position of the row, starting at 0 for the first row.
* @returns {FWorksheet} This sheet, for chaining.
* @example
@@ -814,6 +831,10 @@ export class FWorksheet extends FBaseInitialable {
/**
* Hides the rows in the given range.
+ *
+ * For multiple rows, pass an FRange spanning all target rows in one call. If you already have
+ * a starting index and count, use {@link FWorksheet.hideRows} instead of calling this method for each row.
+ *
* @param {FRange} row - The row range to hide.
* @returns {FWorksheet} This sheet, for chaining.
* @example
@@ -844,6 +865,10 @@ export class FWorksheet extends FBaseInitialable {
/**
* Hides one or more consecutive rows starting at the given index. Use 0-index for this method
+ *
+ * For multiple consecutive rows, pass the full `numRow` in one call instead of looping
+ * with the default count of one.
+ *
* @param {number} rowIndex - The starting index of the rows to hide
* @param {number} [numRow] - The number of rows to hide
* @returns {FWorksheet} This sheet, for chaining.
@@ -878,6 +903,10 @@ export class FWorksheet extends FBaseInitialable {
/**
* Make the row in the given range visible.
+ *
+ * For multiple rows, pass an FRange spanning all target rows in one call. If you already have
+ * a starting index and count, use {@link FWorksheet.showRows} instead of calling this method for each row.
+ *
* @param {FRange} row - The range to unhide, if hidden.
* @returns {FWorksheet} This sheet, for chaining.
* @example
@@ -908,6 +937,10 @@ export class FWorksheet extends FBaseInitialable {
/**
* Unhides one or more consecutive rows starting at the given zero-based index.
+ *
+ * For multiple consecutive rows, pass the full `numRows` in one call instead of looping
+ * with the default count of one.
+ *
* @param {number} rowIndex - The starting index of the rows
* @param {number} [numRows] - The number of rows
* @returns {FWorksheet} This worksheet instance for chaining
@@ -943,6 +976,10 @@ export class FWorksheet extends FBaseInitialable {
/**
* Sets the row height of the given row in pixels. By default, rows grow to fit cell contents. If you want to force rows to a specified height, use setRowHeightsForced(startRow, numRows, height).
+ *
+ * For the same height across consecutive rows, prefer {@link FWorksheet.setRowHeights} with the full
+ * row count instead of calling this method for each row.
+ *
* @param {number} rowPosition - The row position to change.
* @param {number} height - The height in pixels to set it to.
* @returns {FWorksheet} This worksheet instance for chaining
@@ -1213,6 +1250,10 @@ export class FWorksheet extends FBaseInitialable {
/**
* Inserts a column after the given column position.
+ *
+ * To insert multiple columns, prefer {@link FWorksheet.insertColumnsAfter} with the full count
+ * instead of repeatedly calling this method.
+ *
* @param {number} afterPosition - The column after which the new column should be added, starting at 0 for the first column
* @returns {FWorksheet} This worksheet instance for chaining
* @example
@@ -1231,6 +1272,10 @@ export class FWorksheet extends FBaseInitialable {
/**
* Inserts a column before the given column position.
+ *
+ * To insert multiple columns, prefer {@link FWorksheet.insertColumnsBefore} with the full count
+ * instead of repeatedly calling this method.
+ *
* @param {number} beforePosition - The column before which the new column should be added, starting at 0 for the first column
* @returns {FWorksheet} This worksheet instance for chaining
* @example
@@ -1249,6 +1294,10 @@ export class FWorksheet extends FBaseInitialable {
/**
* Inserts one or more consecutive blank columns in a sheet starting at the specified location.
+ *
+ * For multiple consecutive columns, pass the full `numColumns` in one call instead of looping
+ * with the default count of one.
+ *
* @param {number} columnIndex - The index indicating where to insert a column, starting at 0 for the first column
* @param {number} [numColumns] - The number of columns to insert
* @returns {FWorksheet} This sheet, for chaining
@@ -1356,6 +1405,11 @@ export class FWorksheet extends FBaseInitialable {
/**
* Deletes the column at the given column position.
+ *
+ * For consecutive columns, prefer {@link FWorksheet.deleteColumns} with the full count. For
+ * non-contiguous columns, use {@link FWorksheet.deleteColumnsByPoints} so shifting indices are handled
+ * without a manual loop over this method.
+ *
* @param {number} columnPosition - The position of the column, starting at 0 for the first column
* @returns {FWorksheet} This sheet, for chaining
* @example
@@ -1466,6 +1520,10 @@ export class FWorksheet extends FBaseInitialable {
/**
* Hides the column or columns in the given range.
+ *
+ * For multiple columns, pass an FRange spanning all target columns in one call. If you already have
+ * a starting index and count, use {@link FWorksheet.hideColumns} instead of calling this method for each column.
+ *
* @param {FRange} column - The column range to hide
* @returns {FWorksheet} This sheet, for chaining
* @example
@@ -1496,6 +1554,10 @@ export class FWorksheet extends FBaseInitialable {
/**
* Hides one or more consecutive columns starting at the given index. Use 0-index for this method
+ *
+ * For multiple consecutive columns, pass the full `numColumn` in one call instead of looping
+ * with the default count of one.
+ *
* @param {number} columnIndex - The starting index of the columns to hide
* @param {number} [numColumn] - The number of columns to hide
* @returns {FWorksheet} This sheet, for chaining
@@ -1531,6 +1593,10 @@ export class FWorksheet extends FBaseInitialable {
/**
* Show the column in the given range.
+ *
+ * For multiple columns, pass an FRange spanning all target columns in one call. If you already have
+ * a starting index and count, use {@link FWorksheet.showColumns} instead of calling this method for each column.
+ *
* @param {FRange} column - The range to unhide, if hidden
* @returns {FWorksheet} This sheet, for chaining
* @example
@@ -1561,6 +1627,10 @@ export class FWorksheet extends FBaseInitialable {
/**
* Show one or more consecutive columns starting at the given index. Use 0-index for this method
+ *
+ * For multiple consecutive columns, pass the full `numColumns` in one call instead of looping
+ * with the default count of one.
+ *
* @param {number} columnIndex - The starting index of the columns to unhide
* @param {number} [numColumns] - The number of columns to unhide
* @returns {FWorksheet} This sheet, for chaining
@@ -1596,6 +1666,10 @@ export class FWorksheet extends FBaseInitialable {
/**
* Sets the width of the given column in pixels.
+ *
+ * For the same width across consecutive columns, prefer {@link FWorksheet.setColumnWidths} with the
+ * full column count instead of calling this method for each column.
+ *
* @param {number} columnPosition - The position of the given column to set
* @param {number} width - The width in pixels to set it to
* @returns {FWorksheet} This sheet, for chaining