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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix: copy cell should generate html & plain (#4366)
ybzkye2edd0782a71
diff --git a/packages/core/src/index.ts b/packages/core/src/index.tsindex 259e249433..9d2897f2a9 100644--- a/packages/core/src/index.ts+++ b/packages/core/src/index.ts@@ -167,7 +167,7 @@ export {} from './sheets/sheet-snapshot-utils';export { Styles } from './sheets/styles';export * from './sheets/typedef';-export { addLinkToDocumentModel, isRangesEqual, isUnitRangesEqual } from './sheets/util';+export { addLinkToDocumentModel, isNotNullOrUndefined, isRangesEqual, isUnitRangesEqual } from './sheets/util';export { SheetViewModel } from './sheets/view-model';export { createDocumentModelWithStyle } from './sheets/util';export { ImageCacheMap } from './shared/cache/image-cache';diff --git a/packages/core/src/sheets/typedef.ts b/packages/core/src/sheets/typedef.tsindex 82ec74fa47..c087e43322 100644--- a/packages/core/src/sheets/typedef.ts+++ b/packages/core/src/sheets/typedef.ts@@ -665,7 +665,7 @@ export interface ISelectionCell extends IRange, ISingleCell { }/*** ICellInfo has the same properties as ISelectionCell, but the name ICellInfo might be more semantically appropriate in some contexts.*/-export interface ICellInfo extends ISelectionCell {}+export interface ICellInfo extends ISelectionCell { }export interface ISelection {/**@@ -771,3 +771,11 @@ export function getCellInfoInMergeData(row: number, column: number, mergeData?:startColumn: mergeColumn,};}++export type ICellDataWithSpanAndDisplay = ICellData & { rowSpan?: number; colSpan?: number; displayV?: string };++export enum CellModeEnum {+ Raw = 'raw',+ Intercepted = 'intercepted',+ Both = 'both',+}diff --git a/packages/core/src/sheets/util.ts b/packages/core/src/sheets/util.tsindex 055a3d69f9..9258b8d3d9 100644--- a/packages/core/src/sheets/util.ts+++ b/packages/core/src/sheets/util.ts@@ -194,3 +194,7 @@ export function addLinkToDocumentModel(documentModel: DocumentDataModel, linkUrlTextX.apply(body, textX.serialize());}++export function isNotNullOrUndefined<T>(value: T | null | undefined): value is T {+ return value !== null && value !== undefined;+}diff --git a/packages/core/src/sheets/worksheet.ts b/packages/core/src/sheets/worksheet.tsindex 9a9d3cf9c1..5252d9979a 100644--- a/packages/core/src/sheets/worksheet.ts+++ b/packages/core/src/sheets/worksheet.ts@@ -17,7 +17,7 @@import type { IObjectMatrixPrimitiveType, Nullable } from '../shared';import type { IDocumentData, IDocumentRenderConfig, IPaddingData, IStyleData, ITextRotation } from '../types/interfaces';import type { Styles } from './styles';-import type { ICellData, ICellDataForSheetInterceptor, IFreeze, IRange, ISelectionCell, IWorksheetData } from './typedef';+import type { ICellData, ICellDataForSheetInterceptor, ICellDataWithSpanAndDisplay, IFreeze, IRange, ISelectionCell, IWorksheetData } from './typedef';import { BuildTextUtils, DocumentDataModel } from '../docs';import { convertTextRotation, getFontStyleString } from '../docs/data-model/utils';import { composeStyles, ObjectMatrix, Tools } from '../shared';@@ -29,7 +29,8 @@ import { Range } from './range';import { RowManager } from './row-manager';import { mergeWorksheetSnapshotWithDefault } from './sheet-snapshot-utils';import { SpanModel } from './span-model';-import { addLinkToDocumentModel, createDocumentModelWithStyle, DEFAULT_PADDING_DATA, extractOtherStyle, getFontFormat } from './util';+import { CellModeEnum } from './typedef';+import { addLinkToDocumentModel, createDocumentModelWithStyle, DEFAULT_PADDING_DATA, extractOtherStyle, getFontFormat, isNotNullOrUndefined } from './util';import { SheetViewModel } from './view-model';export interface IDocumentLayoutObject {@@ -534,25 +535,55 @@ export class Worksheet {** Notice that `ICellData` here is not after copying. In another word, the object matrix here should be* considered as a slice of the original worksheet data matrix.+ *+ * Control the v attribute in the return cellData.v through dataMode*/++ getMatrixWithMergedCells(+ row: number,+ col: number,+ endRow: number,+ endCol: number+ ): ObjectMatrix<ICellDataWithSpanAndDisplay>;++ getMatrixWithMergedCells(+ row: number,+ col: number,+ endRow: number,+ endCol: number,+ dataMode: CellModeEnum+ ): ObjectMatrix<ICellDataWithSpanAndDisplay>;+getMatrixWithMergedCells(row: number,col: number,endRow: number,endCol: number,- isRaw = false- ): ObjectMatrix<ICellData & { rowSpan?: number; colSpan?: number }> {+ dataMode: CellModeEnum = CellModeEnum.Raw+ ): ObjectMatrix<ICellDataWithSpanAndDisplay> {const matrix = this.getCellMatrix();// get all merged cellsconst mergedCellsInRange = this._spanModel.getMergedCellRange(row, col, endRow, endCol);// iterate all cells in the range- const returnCellMatrix = new ObjectMatrix<ICellData & { rowSpan?: number; colSpan?: number }>();+ const returnCellMatrix = new ObjectMatrix<ICellDataWithSpanAndDisplay>();createRowColIter(row, endRow, col, endCol).forEach((row, col) => {- const v = isRaw ? this.getCellRaw(row, col) : this.getCell(row, col);- if (v) {- returnCellMatrix.setValue(row, col, v);+ let cellData: Nullable<ICellDataWithSpanAndDisplay>;+ if (dataMode === CellModeEnum.Raw) {+ cellData = this.getCellRaw(row, col);+ } else if (dataMode === CellModeEnum.Intercepted) {+ cellData = this.getCell(row, col);+ } else if (dataMode === CellModeEnum.Both) {+ cellData = this.getCellRaw(row, col);+ const displayV = this.getCell(row, col)?.v;+ if (isNotNullOrUndefined(displayV) && cellData) {+ cellData.displayV = String(displayV);+ }+ }++ if (cellData) {+ returnCellMatrix.setValue(row, col, cellData);}});diff --git a/packages/sheets-numfmt-ui/src/controllers/__tests__/cell-content.controller.spec.ts b/packages/sheets-numfmt-ui/src/controllers/__tests__/cell-content.controller.spec.tsindex 339ef71937..2340e75791 100644--- a/packages/sheets-numfmt-ui/src/controllers/__tests__/cell-content.controller.spec.ts+++ b/packages/sheets-numfmt-ui/src/controllers/__tests__/cell-content.controller.spec.ts@@ -30,7 +30,7 @@ describe('test cell-content', () => {let testBed: any;let commandService: ICommandService;beforeEach(() => {- testBed = createTestBed([[SheetsNumfmtCellContentController]]);+ testBed = createTestBed(undefined, [[SheetsNumfmtCellContentController]]);unitId = testBed.unitId;subUnitId = testBed.subUnitId;commandService = testBed.get(ICommandService);diff --git a/packages/sheets-numfmt-ui/src/controllers/__tests__/editor.controller.spec.ts b/packages/sheets-numfmt-ui/src/controllers/__tests__/editor.controller.spec.tsindex f8f31a0553..c5eb77a428 100644--- a/packages/sheets-numfmt-ui/src/controllers/__tests__/editor.controller.spec.ts+++ b/packages/sheets-numfmt-ui/src/controllers/__tests__/editor.controller.spec.ts@@ -14,13 +14,13 @@* limitations under the License.*/-import type { ICellDataForSheetInterceptor, Workbook, Worksheet } from '@univerjs/core';+import type { ICellDataForSheetInterceptor, Injector, Univer, Workbook, Worksheet } from '@univerjs/core';import type { ISetNumfmtMutationParams, ISheetLocation } from '@univerjs/sheets';-import { createInterceptorKey, ICommandService, InterceptorManager, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';+import { CellModeEnum, createInterceptorKey, ICommandService, InterceptorManager, IUniverInstanceService, LocaleType, UniverInstanceType } from '@univerjs/core';import { SetNumfmtMutation, SheetInterceptorService } from '@univerjs/sheets';import { SheetsNumfmtCellContentController } from '@univerjs/sheets-numfmt';-import { IEditorBridgeService } from '@univerjs/sheets-ui';+import { getMatrixPlainText, IEditorBridgeService } from '@univerjs/sheets-ui';import { beforeEach, describe, expect, it } from 'vitest';import { NumfmtEditorController } from '../numfmt.editor.controller';import { createTestBed } from './test.util';@@ -44,7 +44,7 @@ describe('test editor', () => {let commandService: ICommandService;beforeEach(() => {- testBed = createTestBed([+ testBed = createTestBed(undefined, [[NumfmtEditorController],[SheetsNumfmtCellContentController],[IEditorBridgeService, { useClass: MockEditorBridgeService }],@@ -319,3 +319,141 @@ describe('test editor', () => {expect(result?.v).toBeFalsy();});});++describe('test get cell text/plain', () => {+ let univer: Univer;+ let get: Injector['get'];+ let commandService: ICommandService;++ beforeEach(async () => {+ const testBed = createTestBed({+ id: 'test',+ appVersion: '3.0.0-alpha',+ sheets: {+ sheet1: {+ id: 'sheet1',+ cellData: {+ 0: {+ 0: {+ v: 44876,+ t: 2,+ },+ 1: {+ p: {+ id: '__INTERNAL_EDITOR__DOCS_NORMAL',+ documentStyle: {+ pageSize: {+ width: 72.90791320800781,+ },+ marginTop: 0,+ marginBottom: 2,+ marginRight: 2,+ marginLeft: 2,+ renderConfig: {+ verticalAlign: 0,+ horizontalAlign: 0,+ wrapStrategy: 0,+ background: {},+ centerAngle: 0,+ vertexAngle: 0,+ zeroWidthParagraphBreak: 1,+ },+ },+ body: {+ dataStream: 'univer\r\n',+ textRuns: [+ {+ st: 0,+ ed: 1,+ ts: {+ ff: 'Arial',+ fs: 11,+ },+ },+ {+ st: 1,+ ed: 4,+ ts: {+ ff: 'Arial',+ fs: 28,+ },+ },+ {+ st: 4,+ ed: 6,+ ts: {+ ff: 'Arial',+ fs: 11,+ },+ },+ ],+ paragraphs: [+ {+ startIndex: 6,+ paragraphStyle: {+ horizontalAlign: 0,+ },+ },+ ],+ customRanges: [],+ customDecorations: [],+ customBlocks: [],+ },+ drawings: {},+ drawingsOrder: [],+ settings: {+ zoomRatio: 1,+ },+ },+ },+ },+ },+ },+ },+ locale: LocaleType.ZH_CN,+ name: '',+ sheetOrder: [],+ styles: {},+ }, [+ [NumfmtEditorController],+ [SheetsNumfmtCellContentController],+ [IEditorBridgeService, { useClass: MockEditorBridgeService }],+ ]);++ univer = testBed.univer;+ get = testBed.get;+ commandService = get(ICommandService);+ testBed.get(NumfmtEditorController);+ testBed.get(SheetsNumfmtCellContentController);+ testBed.get(SheetInterceptorService);+ });++ it('when the cell has a numfmt should use both to get displayV', () => {+ const univerInstanceService = get(IUniverInstanceService);++ const workbook = univerInstanceService.getUnit<Workbook>('test');+ const worksheet = workbook?.getActiveSheet();+ if (worksheet) {+ const unitId = 'test';+ const subUnitId = worksheet.getSheetId();+ const params: ISetNumfmtMutationParams = {+ unitId,+ subUnitId,+ values: {+ 1: {+ ranges: [{ startRow: 0, endRow: 0, startColumn: 0, endColumn: 0 }],+ },+ },+ refMap: {+ 1: {+ pattern: 'yyyy-mm-dd',+ },+ },+ };+ commandService.syncExecuteCommand(SetNumfmtMutation.id, params);+ const matrix = worksheet.getMatrixWithMergedCells(0, 0, 0, 1, CellModeEnum.Both);+ const plain = getMatrixPlainText(matrix);+ expect(plain).toBe('2022-11-11 univer');+ }+ });+});diff --git a/packages/sheets-numfmt-ui/src/controllers/__tests__/test.util.ts b/packages/sheets-numfmt-ui/src/controllers/__tests__/test.util.tsindex e27b5cf949..c2142643ef 100644--- a/packages/sheets-numfmt-ui/src/controllers/__tests__/test.util.ts+++ b/packages/sheets-numfmt-ui/src/controllers/__tests__/test.util.ts@@ -46,7 +46,7 @@ const TEST_WORKBOOK_DATA_DEMO: () => IWorkbookData = () => ({styles: {},});-export const createTestBed = (dependencies?: Dependency[]) => {+export const createTestBed = (defaultWorkbook?: IWorkbookData, dependencies?: Dependency[]) => {const univer = new Univer();const injector = univer.__getInjector();const get = injector.get.bind(injector);@@ -81,7 +81,7 @@ export const createTestBed = (dependencies?: Dependency[]) => {univer.registerPlugin(TestPlugin);- const workbookJson = TEST_WORKBOOK_DATA_DEMO();+ const workbookJson = defaultWorkbook ?? TEST_WORKBOOK_DATA_DEMO();const sheet = univer.createUniverSheet(workbookJson);const univerInstanceService = injector.get(IUniverInstanceService);diff --git a/packages/sheets-ui/src/common/utils.ts b/packages/sheets-ui/src/common/utils.tsindex e78f6877d4..8d09820eae 100644--- a/packages/sheets-ui/src/common/utils.ts+++ b/packages/sheets-ui/src/common/utils.ts@@ -19,7 +19,7 @@ import type { IBoundRectNoAngle, IRender, Scene, SpreadsheetSkeleton } from '@unimport type { ICollaborator } from '@univerjs/protocol';import type { ISetRangeValuesMutationParams, ISheetLocation } from '@univerjs/sheets';import type { ISheetSkeletonManagerParam } from '../services/sheet-skeleton-manager.service';-import { ObjectMatrix } from '@univerjs/core';+import { CellModeEnum, ObjectMatrix } from '@univerjs/core';import { SHEET_VIEWPORT_KEY, Vector2 } from '@univerjs/engine-render';import { SetRangeValuesMutation, SetRangeValuesUndoMutationFactory } from '@univerjs/sheets';@@ -90,7 +90,7 @@ export function getClearContentMutationParamsForRanges(export function getClearContentMutationParamForRange(worksheet: Worksheet, range: IRange): ObjectMatrix<Nullable<ICellData>> {const { startRow, startColumn, endColumn, endRow } = range;- const cellMatrix = worksheet.getMatrixWithMergedCells(startRow, startColumn, endRow, endColumn, true);+ const cellMatrix = worksheet.getMatrixWithMergedCells(startRow, startColumn, endRow, endColumn, CellModeEnum.Intercepted);const redoMatrix = new ObjectMatrix<Nullable<ICellData>>();let leftTopCellValue: Nullable<ICellData> = null;cellMatrix.forValue((row, col, cellData) => {diff --git a/packages/sheets-ui/src/index.ts b/packages/sheets-ui/src/index.tsindex 166a460ef3..ccfd0fe7a0 100644--- a/packages/sheets-ui/src/index.ts+++ b/packages/sheets-ui/src/index.ts@@ -61,6 +61,7 @@ export type { IAutoFillLocation, ICopyDataPiece, ISheetAutoFillHook } from './seexport { type ICanvasPopup, SheetCanvasPopManagerService } from './services/canvas-pop-manager.service';export { CellAlertManagerService, CellAlertType, type ICellAlert } from './services/cell-alert-manager.service';export {+ getMatrixPlainText,ISheetClipboardService,PREDEFINED_HOOK_NAME,SheetClipboardService,diff --git a/packages/sheets-ui/src/services/clipboard/__tests__/utils.spec.ts b/packages/sheets-ui/src/services/clipboard/__tests__/utils.spec.tsindex 01e686c399..6b1ea9bf18 100644--- a/packages/sheets-ui/src/services/clipboard/__tests__/utils.spec.ts+++ b/packages/sheets-ui/src/services/clipboard/__tests__/utils.spec.ts@@ -143,12 +143,12 @@ describe('test "mergeSetRangeValues"', () => {expect(mergeSetRangeValues(mutations)).toStrictEqual([]);});- it ('no setRangeValues mutations, will no nothing', () => {+ it('no setRangeValues mutations, will no nothing', () => {const mutations: IMutationInfo[] = [{ id: 'whatever', params: {} }];expect(mergeSetRangeValues(mutations)).toStrictEqual([{ id: 'whatever', params: {} }]);});- it ('setRangeValues mutations are not applied in same worksheet, will do nothing', () => {+ it('setRangeValues mutations are not applied in same worksheet, will do nothing', () => {const mutations: IMutationInfo[] = [{ id: 'whatever', params: {} },{ id: SetRangeValuesMutation.id, params: { unitId: '1', subUnitId: '2', cellValue: { 1: { 2: { v: 'value' } } } } },@@ -160,7 +160,7 @@ describe('test "mergeSetRangeValues"', () => {{ id: SetRangeValuesMutation.id, params: { unitId: '1', subUnitId: '3', cellValue: { 1: { 2: { v: 'value' } } } } },{ id: 'whatever', params: {} }]);});- it ('part of setRangeValues mutations are applied in same worksheet, will merge these part', () => {+ it('part of setRangeValues mutations are applied in same worksheet, will merge these part', () => {const mutations: IMutationInfo[] = [{ id: 'whatever', params: {} },{ id: SetRangeValuesMutation.id, params: { unitId: '1', subUnitId: '2', cellValue: { 1: { 2: { v: 'value' } } } } },@@ -174,7 +174,7 @@ describe('test "mergeSetRangeValues"', () => {{ id: 'whatever', params: {} }]);});- it ('If some setRangeValues appear discontinuously, they will be merged separately.', () => {+ it('If some setRangeValues appear discontinuously, they will be merged separately.', () => {const mutations: IMutationInfo[] = [{ id: 'whatever', params: {} },{ id: SetRangeValuesMutation.id, params: { unitId: '1', subUnitId: '2', cellValue: { 1: { 2: { v: 'value' } } } } },diff --git a/packages/sheets-ui/src/services/clipboard/clipboard.service.ts b/packages/sheets-ui/src/services/clipboard/clipboard.service.tsindex f6dae91a44..f41eb4b173 100644--- a/packages/sheets-ui/src/services/clipboard/clipboard.service.ts+++ b/packages/sheets-ui/src/services/clipboard/clipboard.service.ts@@ -15,7 +15,7 @@*/import type {- ICellData, IDisposable,+ ICellData, ICellDataWithSpanAndDisplay, IDisposable,IMutationInfo,IRange,Nullable, Workbook, Worksheet,@@ -23,7 +23,6 @@ import type {import type { ISetSelectionsOperationParams } from '@univerjs/sheets';import type { IDiscreteRange } from '../../controllers/utils/range-tools';import type {- ICellDataWithSpanInfo,IClipboardPropertyItem,IPasteTarget,ISheetClipboardHook,@@ -31,10 +30,12 @@ import type {IUniverSheetCopyDataModel,} from './type';import {+ CellModeEnum,createIdentifier, Disposable, ErrorService, extractPureTextFromCell, ICommandService,ILogService,Inject,Injector,+ isNotNullOrUndefined,IUndoRedoService,IUniverInstanceService,LocaleService,@@ -82,7 +83,7 @@ interface ICopyContent {copyId: string;plain: string;html: string;- matrixFragment: ObjectMatrix<ICellDataWithSpanInfo>;+ matrixFragment: ObjectMatrix<ICellDataWithSpanAndDisplay>;discreteRange: IDiscreteRange;}@@ -303,9 +304,8 @@ export class SheetClipboardService extends Disposable implements ISheetClipboard// calculate selection matrix, span cells would only - maybe warn uses that cells are too may in the futureconst { startColumn, startRow, endColumn, endRow } = range;- // TODO @ybzky This needs to be optimized. Both cell and cellRaw should be obtained, one for html and one for plain- const matrix = worksheet.getMatrixWithMergedCells(startRow, startColumn, endRow, endColumn, true);- const matrixFragment = new ObjectMatrix<ICellDataWithSpanInfo>();+ const matrix = worksheet.getMatrixWithMergedCells(startRow, startColumn, endRow, endColumn, CellModeEnum.Both);+ const matrixFragment = new ObjectMatrix<ICellDataWithSpanAndDisplay>();let rowIndex = startRow;const discreteRange: IDiscreteRange = { rows: [], cols: [] };@@ -701,7 +701,7 @@ export class SheetClipboardService extends Disposable implements ISheetClipboardunitId: string,subUnitId: string,range: IDiscreteRange,- cellMatrix: ObjectMatrix<ICellDataWithSpanInfo>,+ cellMatrix: ObjectMatrix<ICellDataWithSpanAndDisplay>,pasteType?: string) {const worksheet = this._univerInstanceService.getUniverSheetInstance(unitId)?.getSheetBySheetId(subUnitId);@@ -824,7 +824,7 @@ export class SheetClipboardService extends Disposable implements ISheetClipboardprivate _transformPastedData(rowCount: number,colCount: number,- cellMatrix: ObjectMatrix<ICellDataWithSpanInfo>+ cellMatrix: ObjectMatrix<ICellDataWithSpanAndDisplay>): IPasteTarget | null {const target = this._getPastingTarget();const { selection, unitId, subUnitId } = target;@@ -955,7 +955,7 @@ export class SheetClipboardService extends Disposable implements ISheetClipboard};}- private _getPastedRange(cellMatrix: ObjectMatrix<ICellDataWithSpanInfo>) {+ private _getPastedRange(cellMatrix: ObjectMatrix<ICellDataWithSpanAndDisplay>) {const target = this._getPastingTarget();const { selection, unitId, subUnitId } = target;if (!subUnitId || !selection) {@@ -1100,7 +1100,7 @@ export class SheetClipboardService extends Disposable implements ISheetClipboard// #region copy generation-function getMatrixPlainText(matrix: ObjectMatrix<ICellDataWithSpanInfo>) {+export function getMatrixPlainText(matrix: ObjectMatrix<ICellDataWithSpanAndDisplay>) {let plain = '';const matrixLength = matrix.getLength();matrix.forRow((row, cols) => {@@ -1121,7 +1121,10 @@ function getMatrixPlainText(matrix: ObjectMatrix<ICellDataWithSpanInfo>) {return plain;}-function getCellTextForClipboard(cell: ICellDataWithSpanInfo) {+function getCellTextForClipboard(cell: ICellDataWithSpanAndDisplay) {+ if (isNotNullOrUndefined(cell.displayV)) {+ return cell.displayV;+ }return extractPureTextFromCell(cell);}@@ -1160,7 +1163,7 @@ function columnAcrossMergedCell(col: number, startRow: number, endRow: number, w* Determine whether CellMatrix consists of multiple cells, it must consist of 2 or more cells. It can be an ordinary cell or merge cell* @param cellMatrix*/-function isMultipleCells(cellMatrix: ObjectMatrix<ICellDataWithSpanInfo>): boolean {+function isMultipleCells(cellMatrix: ObjectMatrix<ICellDataWithSpanAndDisplay>): boolean {let count = 0;cellMatrix.forValue((row, col, cell) => {if (cell) {diff --git a/packages/sheets-ui/src/services/clipboard/type.ts b/packages/sheets-ui/src/services/clipboard/type.tsindex 3c80592ae7..e99a1cd0a2 100644--- a/packages/sheets-ui/src/services/clipboard/type.ts+++ b/packages/sheets-ui/src/services/clipboard/type.ts@@ -22,7 +22,7 @@ export enum COPY_TYPE {CUT = 'CUT',}-export type ICellDataWithSpanInfo = ICellData & { rowSpan?: number; colSpan?: number };+export type ICellDataWithSpanInfo = ICellData & { rowSpan?: number; colSpan?: number; plain?: string };export interface IClipboardPropertyItem {[key: string]: string;diff --git a/packages/sheets/src/commands/commands/add-worksheet-merge.command.ts b/packages/sheets/src/commands/commands/add-worksheet-merge.command.tsindex f74c51d9a7..bb3e77fc2e 100644--- a/packages/sheets/src/commands/commands/add-worksheet-merge.command.ts+++ b/packages/sheets/src/commands/commands/add-worksheet-merge.command.ts@@ -22,6 +22,7 @@ import type {import type { ISetRangeValuesMutationParams } from '../mutations/set-range-values.mutation';import {+ CellModeEnum,CommandType,Dimension,ICommandService,@@ -105,7 +106,7 @@ function getClearContentMutationParamsForRanges(function getClearContentMutationParamForRange(worksheet: Worksheet, range: IRange): ObjectMatrix<Nullable<ICellData>> {const { startRow, startColumn, endColumn, endRow } = range;- const cellMatrix = worksheet.getMatrixWithMergedCells(startRow, startColumn, endRow, endColumn, true);+ const cellMatrix = worksheet.getMatrixWithMergedCells(startRow, startColumn, endRow, endColumn, CellModeEnum.Intercepted);const redoMatrix = new ObjectMatrix<Nullable<ICellData>>();cellMatrix.forValue((row, col, cellData) => {if (cellData && (row !== startRow || col !== startColumn)) {