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: fix extracted value from cell content
Wenzhao Hu2e22324ac934
diff --git a/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts b/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.tsindex 8f205499ec..af19337b60 100644--- a/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts+++ b/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts@@ -30,6 +30,7 @@ import {DEFAULT_WORKSHEET_COLUMN_WIDTH,DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY,DEFAULT_WORKSHEET_ROW_HEIGHT,+ extractPureTextFromCell,handleStyleToString,ICommandService,IConfigService,@@ -162,7 +163,8 @@ export class SheetClipboardController extends RxDisposable {},onCopyCellContent(row: number, col: number): string {const cell = currentSheet!.getCell(row, col);- return `${cell?.v || ''}`;+ const content = cell ? extractPureTextFromCell(cell) : '';+ return content;},onCopyCellStyle: (row: number, col: number, rowSpan?: number, colSpan?: number) => {const properties: IClipboardPropertyItem = {};diff --git a/packages/sheets-ui/src/services/clipboard/clipboard.service.ts b/packages/sheets-ui/src/services/clipboard/clipboard.service.tsindex e71bd70a46..8cf61b6d33 100644--- a/packages/sheets-ui/src/services/clipboard/clipboard.service.ts+++ b/packages/sheets-ui/src/services/clipboard/clipboard.service.ts@@ -17,6 +17,7 @@import type { ICellData, IMutationInfo, IRange, Worksheet } from '@univerjs/core';import {Disposable,+ extractPureTextFromCell,ICommandService,ILogService,IUndoRedoService,@@ -861,7 +862,7 @@ function getMatrixPlainText(matrix: ObjectMatrix<ICellDataWithSpanInfo>) {}function getCellTextForClipboard(cell: ICellDataWithSpanInfo) {- const formatValue = cell.v;+ const formatValue = extractPureTextFromCell(cell);return escapeSpecialCode(formatValue?.toString() || '');}