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.

fix: fixed issue with pasting values from outside into text format cells (#4944)

wpxp1234560547866e95a2
diff --git a/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts b/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts
index 744f87e450..da4ba3f45e 100644
--- a/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts
+++ b/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts
@@ -720,6 +720,7 @@ export class SheetClipboardController extends RxDisposable {
const { undos: setStyleUndos, redos: setStyleRedos } = this._injector.invoke((accessor) => {
return getSetCellStyleMutations(
pasteTo,
+ pasteFrom,
matrix,
accessor
);
diff --git a/packages/sheets-ui/src/controllers/clipboard/utils.ts b/packages/sheets-ui/src/controllers/clipboard/utils.ts
index f6ca0d1695..407fef4d70 100644
--- a/packages/sheets-ui/src/controllers/clipboard/utils.ts
+++ b/packages/sheets-ui/src/controllers/clipboard/utils.ts
@@ -25,8 +25,10 @@ import type {
ISetSelectionsOperationParams,
} from '@univerjs/sheets';
import type { ICellDataWithSpanInfo, ICopyPastePayload, ISheetDiscreteRangeLocation } from '../../services/clipboard/type';
-import { cellToRange, CustomRangeType, DEFAULT_STYLES, generateRandomId, IUniverInstanceService, numfmt, ObjectMatrix, Range, Rectangle, Tools } from '@univerjs/core';
+import type { IDiscreteRange } from '../utils/range-tools';
+import { cellToRange, CellValueType, CustomRangeType, DEFAULT_STYLES, generateRandomId, IUniverInstanceService, numfmt, ObjectMatrix, Range, Rectangle, Tools } from '@univerjs/core';
+import { isTextFormat } from '@univerjs/engine-numfmt';
import { DEFAULT_PADDING_DATA } from '@univerjs/engine-render';
import {
AddMergeUndoMutationFactory,
@@ -44,7 +46,7 @@ import {
} from '@univerjs/sheets';
import { COPY_TYPE } from '../../services/clipboard/type';
import { isRichText } from '../editor/editing.render-controller';
-import { discreteRangeToRange, type IDiscreteRange, virtualizeDiscreteRanges } from '../utils/range-tools';
+import { discreteRangeToRange, virtualizeDiscreteRanges } from '../utils/range-tools';
// if special paste need append mutations instead of replace the default, it can use this function to generate default mutations.
/**
@@ -85,7 +87,7 @@ export function getDefaultOnPasteCellMutations(
undoMutationsInfo.push(...setValuesUndos);
// set styles
- const { undos: setStyleUndos, redos: setStyleRedos } = getSetCellStyleMutations(pasteTo, data, accessor, true);
+ const { undos: setStyleUndos, redos: setStyleRedos } = getSetCellStyleMutations(pasteTo, pasteFrom, data, accessor, true);
redoMutationsInfo.push(...setStyleRedos);
undoMutationsInfo.push(...setStyleUndos);
@@ -323,27 +325,42 @@ export function getSetCellValueMutations(
accessor: IAccessor
) {
const { unitId, subUnitId, range } = pasteTo;
+ const worksheet = accessor.get(IUniverInstanceService).getUniverSheetInstance(unitId)?.getSheetBySheetId(subUnitId);
const redoMutationsInfo: IMutationInfo[] = [];
const undoMutationsInfo: IMutationInfo[] = [];
const { mapFunc } = virtualizeDiscreteRanges([range]);
const valueMatrix = new ObjectMatrix<ICellData>();
matrix.forValue((row, col, value) => {
- let originNumberValue;
+ const { row: realRow, col: realCol } = mapFunc(row, col);
+
+ const cellValue: ICellData = {
+ v: value.v,
+ t: value.t,
+ };
+
if (!value.p && value.v && !pasteFrom) {
- const content = String(value.v);
- const numfmtValue = numfmt.parseValue(content);
- if (numfmtValue?.v !== undefined && typeof numfmtValue.v === 'number') {
- originNumberValue = numfmtValue.v;
+ // pasteFrom is null, means the data is pasted from outside, at this time, the data has no number format.
+ // If the paste to cell has a number format, google sheet will apply the number format, but excel will not.
+ // Here the text format need to be handled, other number format need to discuss. TODO: @wzhudev @ybzky
+ const style = worksheet?.getCellStyle(realRow, realCol);
+
+ if (isTextFormat(style?.n?.pattern)) {
+ cellValue.t = CellValueType.STRING;
+ } else {
+ const content = String(value.v);
+ const numfmtValue = numfmt.parseValue(content);
+ if (numfmtValue?.v !== undefined && typeof numfmtValue.v === 'number') {
+ cellValue.v = numfmtValue.v;
+ }
}
}
- const { row: realRow, col: realCol } = mapFunc(row, col);
if (value.p?.body && isRichText(value.p.body)) {
- const newValue = Tools.deepClone({ p: value.p, v: originNumberValue ?? value.v });
+ const newValue = Tools.deepClone({ p: value.p, v: value.v });
valueMatrix.setValue(realRow, realCol, newValue);
} else {
- valueMatrix.setValue(realRow, realCol, Tools.deepClone({ v: originNumberValue ?? value.v, t: value.t }));
+ valueMatrix.setValue(realRow, realCol, Tools.deepClone(cellValue));
}
});
// set cell value and style
@@ -383,6 +400,7 @@ export function getSetCellValueMutations(
*/
export function getSetCellStyleMutations(
pasteTo: ISheetDiscreteRangeLocation,
+ pasteFrom: Nullable<ISheetDiscreteRangeLocation>,
matrix: ObjectMatrix<ICellDataWithSpanInfo>,
accessor: IAccessor,
withRichFormat = false
@@ -390,6 +408,7 @@ export function getSetCellStyleMutations(
const redoMutationsInfo: IMutationInfo[] = [];
const undoMutationsInfo: IMutationInfo[] = [];
const { unitId, subUnitId, range } = pasteTo;
+ const worksheet = accessor.get(IUniverInstanceService).getUniverSheetInstance(unitId)?.getSheetBySheetId(subUnitId);
const valueMatrix = new ObjectMatrix<ICellData>();
const { mapFunc } = virtualizeDiscreteRanges([range]);
@@ -419,21 +438,35 @@ export function getSetCellStyleMutations(
}
}
- const content = String(value.v);
- const numfmtValue = numfmt.parseValue(content);
- if (numfmtValue?.z) {
+ const { row: actualRow, col: actualCol } = mapFunc(row, col);
+
+ // pasteFrom is null, means the data is pasted from outside, at this time, the data has no number format.
+ // If the paste to cell has a number format, google sheet will apply the number format, but excel will not.
+ // Here the text format need to be handled, other number format need to discuss. TODO: @wzhudev @ybzky
+ const style = worksheet?.getCellStyle(actualRow, actualCol);
+
+ if (value.v && !pasteFrom && isTextFormat(style?.n?.pattern)) {
if (!newValue.s) {
newValue.s = {};
}
- if (typeof newValue.s === 'object') {
- if (!newValue.s?.n) {
- newValue.s.n = { pattern: numfmtValue.z };
- } else {
- newValue.s.n.pattern = numfmtValue.z;
+ (newValue.s as IStyleData).n = style?.n;
+ } else {
+ const content = String(value.v);
+ const numfmtValue = numfmt.parseValue(content);
+ if (numfmtValue?.z) {
+ if (!newValue.s) {
+ newValue.s = {};
+ }
+ if (typeof newValue.s === 'object') {
+ if (!newValue.s?.n) {
+ newValue.s.n = { pattern: numfmtValue.z };
+ } else {
+ newValue.s.n.pattern = numfmtValue.z;
+ }
}
}
}
- const { row: actualRow, col: actualCol } = mapFunc(row, col);
+
valueMatrix.setValue(actualRow, actualCol, newValue);
});
// set cell style
diff --git a/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-paste-form-excel.spec.ts b/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-paste-form-excel.spec.ts
index 48e9ae9181..bfea56f2fe 100644
--- a/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-paste-form-excel.spec.ts
+++ b/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-paste-form-excel.spec.ts
@@ -16,6 +16,7 @@
import type { ICellData, Injector, IStyleData, Nullable, Univer } from '@univerjs/core';
import { ICommandService, IUniverInstanceService, LocaleType, RANGE_TYPE } from '@univerjs/core';
+import { DEFAULT_TEXT_FORMAT_EXCEL } from '@univerjs/engine-numfmt';
import {
AddWorksheetMergeMutation,
MoveRangeMutation,
@@ -26,12 +27,12 @@ import {
SetWorksheetRowHeightMutation,
SheetsSelectionsService,
} from '@univerjs/sheets';
-import { afterEach, beforeEach, describe, expect, it } from 'vitest';
+import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import { SheetSkeletonManagerService } from '../../sheet-skeleton-manager.service';
import { ISheetClipboardService } from '../clipboard.service';
import { clipboardTestBed } from './clipboard-test-bed';
-import { excelSample } from './constant';
+import { excelSample, excelSample2 } from './constant';
describe('Test clipboard', () => {
let univer: Univer;
@@ -66,6 +67,20 @@ describe('Test clipboard', () => {
0: {
v: 1,
},
+ 10: { // K1
+ s: {
+ bg: {
+ rgb: '#274fee',
+ },
+ },
+ },
+ 11: { // L1
+ s: {
+ n: {
+ pattern: DEFAULT_TEXT_FORMAT_EXCEL,
+ },
+ },
+ },
},
},
},
@@ -241,5 +256,73 @@ describe('Test clipboard', () => {
const cellValue = getValues(1, 1, 1, 1)?.[0]?.[0];
expect(cellValue?.f).toEqual('=SUM(A1');
});
+
+ it('test paste to range K1:L1, K1 has style, L1 has text format', async () => {
+ const worksheet = get(IUniverInstanceService).getUniverSheetInstance('test')?.getSheetBySheetId('sheet1');
+ if (!worksheet) return false;
+
+ // set selection to K1:L1
+ const selectionManager = get(SheetsSelectionsService);
+ selectionManager.addSelections([
+ {
+ range: {
+ startRow: 0,
+ startColumn: 10,
+ endRow: 0,
+ endColumn: 11,
+ rangeType: RANGE_TYPE.NORMAL,
+ },
+ primary: null,
+ style: null,
+ },
+ ]);
+
+ // paste data, excelSample2 value is 000123456
+ const res = await sheetClipboardService.legacyPaste(excelSample2);
+ expect(res).toBeTruthy();
+
+ // check the values
+ const K1CellValue = getValues(0, 10, 0, 10)?.[0]?.[0];
+ const L1CellValue = getValues(0, 11, 0, 11)?.[0]?.[0];
+ expect(K1CellValue?.v).toStrictEqual(123456);
+ expect(L1CellValue?.v).toStrictEqual('000123456');
+
+ // check the styles
+ const K1CellStyle = getStyles(0, 10, 0, 10)?.[0]?.[0];
+ const L1CellStyle = getStyles(0, 11, 0, 11)?.[0]?.[0];
+ expect(K1CellStyle).toStrictEqual({
+ ff: '等线',
+ fs: 11,
+ it: 0,
+ bl: 0,
+ ul: { s: 0, cl: { rgb: 'rgb(0,0,0)' } },
+ st: { s: 0, cl: { rgb: 'rgb(0,0,0)' } },
+ ol: { s: 0, cl: { rgb: 'rgb(0,0,0)' } },
+ tr: { a: 0, v: 0 },
+ td: 0,
+ cl: { rgb: 'rgb(0,0,0)' },
+ ht: 0,
+ vt: 2,
+ tb: 1,
+ pd: { t: 0, b: 2, l: 2, r: 2 },
+ });
+ expect(L1CellStyle).toStrictEqual({
+ n: { pattern: DEFAULT_TEXT_FORMAT_EXCEL },
+ ff: '等线',
+ fs: 11,
+ it: 0,
+ bl: 0,
+ ul: { s: 0, cl: { rgb: 'rgb(0,0,0)' } },
+ st: { s: 0, cl: { rgb: 'rgb(0,0,0)' } },
+ ol: { s: 0, cl: { rgb: 'rgb(0,0,0)' } },
+ tr: { a: 0, v: 0 },
+ td: 0,
+ cl: { rgb: 'rgb(0,0,0)' },
+ ht: 0,
+ vt: 2,
+ tb: 1,
+ pd: { t: 0, b: 2, l: 2, r: 2 },
+ });
+ });
});
});
diff --git a/packages/sheets-ui/src/services/clipboard/__tests__/constant.ts b/packages/sheets-ui/src/services/clipboard/__tests__/constant.ts
index befda6205e..71d542caa2 100644
--- a/packages/sheets-ui/src/services/clipboard/__tests__/constant.ts
+++ b/packages/sheets-ui/src/services/clipboard/__tests__/constant.ts
@@ -16,6 +16,9 @@
export const excelSample = '<html xmlns:v="urn:schemas-microsoft-com:vml"\r\nxmlns:o="urn:schemas-microsoft-com:office:office"\r\nxmlns:x="urn:schemas-microsoft-com:office:excel"\r\nxmlns="http://www.w3.org/TR/REC-html40">\r\n\r\n<head>\r\n<meta http-equiv=Content-Type content="text/html; charset=utf-8">\r\n<meta name=ProgId content=Excel.Sheet>\r\n<meta name=Generator content="Microsoft Excel 15">\r\n<link id=Main-File rel=Main-File\r\nhref="file:////Users/yuanbin/Library/Group%20Containers/UBF8T346G9.Office/TemporaryItems/msohtmlclip/clip.htm">\r\n<link rel=File-List\r\nhref="file:////Users/yuanbin/Library/Group%20Containers/UBF8T346G9.Office/TemporaryItems/msohtmlclip/clip_filelist.xml">\r\n<style>\r\n\x3C!--table\r\n\t{mso-displayed-decimal-separator:"\\.";\r\n\tmso-displayed-thousand-separator:"\\,";}\r\n@page\r\n\t{margin:.75in .7in .75in .7in;\r\n\tmso-header-margin:.3in;\r\n\tmso-footer-margin:.3in;}\r\n.font0\r\n\t{color:black;\r\n\tfont-size:12.0pt;\r\n\tfont-weight:400;\r\n\tfont-style:normal;\r\n\ttext-decoration:none;\r\n\tfont-family:等线;\r\n\tmso-generic-font-family:auto;\r\n\tmso-font-charset:134;}\r\n.font5\r\n\t{color:windowtext;\r\n\tfont-size:9.0pt;\r\n\tfont-weight:400;\r\n\tfont-style:normal;\r\n\ttext-decoration:none;\r\n\tfont-family:等线;\r\n\tmso-generic-font-family:auto;\r\n\tmso-font-charset:134;}\r\n.font6\r\n\t{color:#DAE9F8;\r\n\tfont-size:28.0pt;\r\n\tfont-weight:700;\r\n\tfont-style:italic;\r\n\ttext-decoration:none;\r\n\tfont-family:等线;\r\n\tmso-generic-font-family:auto;\r\n\tmso-font-charset:134;}\r\ntr\r\n\t{mso-height-source:auto;\r\n\tmso-ruby-visibility:none;}\r\ncol\r\n\t{mso-width-source:auto;\r\n\tmso-ruby-visibility:none;}\r\nbr\r\n\t{mso-data-placement:same-cell;}\r\ntd\r\n\t{padding-top:1px;\r\n\tpadding-right:1px;\r\n\tpadding-left:1px;\r\n\tmso-ignore:padding;\r\n\tcolor:black;\r\n\tfont-size:12.0pt;\r\n\tfont-weight:400;\r\n\tfont-style:normal;\r\n\ttext-decoration:none;\r\n\tfont-family:等线;\r\n\tmso-generic-font-family:auto;\r\n\tmso-font-charset:134;\r\n\tmso-number-format:General;\r\n\ttext-align:general;\r\n\tvertical-align:middle;\r\n\tborder:none;\r\n\tmso-background-source:auto;\r\n\tmso-pattern:auto;\r\n\tmso-protection:locked visible;\r\n\twhite-space:nowrap;\r\n\tmso-rotate:0;}\r\n.xl65\r\n\t{font-weight:700;\r\n\tfont-style:italic;}\r\n.xl66\r\n\t{text-align:center;\r\n\tborder-top:.5pt solid windowtext;\r\n\tborder-right:none;\r\n\tborder-bottom:.5pt solid windowtext;\r\n\tborder-left:.5pt solid windowtext;}\r\n.xl67\r\n\t{text-align:center;\r\n\tborder-top:.5pt solid windowtext;\r\n\tborder-right:.5pt solid windowtext;\r\n\tborder-bottom:.5pt solid windowtext;\r\n\tborder-left:none;}\r\n.xl68\r\n\t{text-align:center;\r\n\tborder-top:.5pt solid windowtext;\r\n\tborder-right:none;\r\n\tborder-bottom:none;\r\n\tborder-left:.5pt solid windowtext;}\r\n.xl69\r\n\t{text-align:center;\r\n\tborder-top:.5pt solid windowtext;\r\n\tborder-right:.5pt solid windowtext;\r\n\tborder-bottom:none;\r\n\tborder-left:none;}\r\n.xl70\r\n\t{text-align:center;\r\n\tborder-top:none;\r\n\tborder-right:none;\r\n\tborder-bottom:.5pt solid windowtext;\r\n\tborder-left:.5pt solid windowtext;}\r\n.xl71\r\n\t{text-align:center;\r\n\tborder-top:none;\r\n\tborder-right:.5pt solid windowtext;\r\n\tborder-bottom:.5pt solid windowtext;\r\n\tborder-left:none;}\r\n.xl72\r\n\t{mso-number-format:"Short Date";}\r\n.xl73\r\n\t{background:#0F9ED5;\r\n\tmso-pattern:black none;}\r\n.xl74\r\n\t{text-align:center;\r\n\tborder-top:.5pt solid windowtext;\r\n\tborder-right:.5pt solid windowtext;\r\n\tborder-bottom:none;\r\n\tborder-left:.5pt solid windowtext;\r\n\tbackground:#0F9ED5;\r\n\tmso-pattern:black none;}\r\n.xl75\r\n\t{text-align:center;\r\n\tborder-top:none;\r\n\tborder-right:.5pt solid windowtext;\r\n\tborder-bottom:none;\r\n\tborder-left:.5pt solid windowtext;\r\n\tbackground:#0F9ED5;\r\n\tmso-pattern:black none;}\r\n.xl76\r\n\t{text-align:center;\r\n\tborder-top:none;\r\n\tborder-right:.5pt solid windowtext;\r\n\tborder-bottom:.5pt solid windowtext;\r\n\tborder-left:.5pt solid windowtext;\r\n\tbackground:#0F9ED5;\r\n\tmso-pattern:black none;}\r\nruby\r\n\t{ruby-align:left;}\r\nrt\r\n\t{color:windowtext;\r\n\tfont-size:9.0pt;\r\n\tfont-weight:400;\r\n\tfont-style:normal;\r\n\ttext-decoration:none;\r\n\tfont-family:等线;\r\n\tmso-generic-font-family:auto;\r\n\tmso-font-charset:134;\r\n\tmso-char-type:none;\r\n\tdisplay:none;}\r\n-->\r\n</style>\r\n</head>\r\n\r\n<div style=\'max-height:42px\'></div>\r\n\r\n<body link="#467886" vlink="#96607D">\r\n\r\n<table border=0 cellpadding=0 cellspacing=0 width=354 style=\'border-collapse:\r\n collapse;width:265pt\'>\r\n\x3C!--StartFragment-->\r\n <col width=87 style=\'width:65pt\'>\r\n <col width=93 style=\'mso-width-source:userset;mso-width-alt:2986;width:70pt\'>\r\n <col width=87 span=2 style=\'width:65pt\'>\r\n <tr height=21 style=\'height:16.0pt\'>\r\n <td height=21 width=87 style=\'height:16.0pt;width:65pt\'></td>\r\n <td width=93 style=\'width:70pt\'></td>\r\n <td width=87 style=\'width:65pt\'></td>\r\n <td width=87 style=\'width:65pt\'></td>\r\n </tr>\r\n <div style=\'max-height:84px\'></div>\r\n <tr height=47 style=\'height:35.0pt\'>\r\n <td height=47 style=\'height:35.0pt\'></td>\r\n <td class=xl65>Univer</td>\r\n <td class=xl73>U<font class="font6">niv</font><font class="font0">er</font></td>\r\n <td></td>\r\n </tr>\r\n <tr height=21 style=\'height:16.0pt\'>\r\n <td height=21 style=\'height:16.0pt\'></td>\r\n <td></td>\r\n <td></td>\r\n <td></td>\r\n </tr>\r\n <tr height=21 style=\'height:16.0pt\'>\r\n <td height=21 style=\'height:16.0pt\'></td>\r\n <td colspan=2 class=xl66 style=\'border-right:.5pt solid black\'>Univer</td>\r\n <td></td>\r\n </tr>\r\n <tr height=21 style=\'height:16.0pt\'>\r\n <td height=21 style=\'height:16.0pt\'></td>\r\n <td></td>\r\n <td></td>\r\n <td></td>\r\n </tr>\r\n <tr height=21 style=\'height:16.0pt\'>\r\n <td height=21 style=\'height:16.0pt\'></td>\r\n <td colspan=2 rowspan=2 class=xl68 style=\'border-right:.5pt solid black;\r\n border-bottom:.5pt solid black\'>Univer</td>\r\n <td></td>\r\n </tr>\r\n <tr height=21 style=\'height:16.0pt\'>\r\n <td height=21 style=\'height:16.0pt\' data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:45607}"\r\n data-sheets-numberformat="{&quot;1&quot;:5,&quot;2&quot;:&quot;yyyy/m/d&quot;,&quot;3&quot;:1}"></td>\r\n <td></td>\r\n </tr>\r\n <tr height=21 style=\'height:16.0pt\'>\r\n <td height=21 style=\'height:16.0pt\'></td>\r\n <td></td>\r\n <td></td>\r\n <td></td>\r\n </tr>\r\n <tr height=35 style=\'height:26.0pt\'>\r\n <td height=35 style=\'height:26.0pt\'></td>\r\n <td rowspan=5 class=xl74 style=\'border-bottom:.5pt solid black\'>Univer</td>\r\n <td></td>\r\n <td></td>\r\n </tr>\r\n <tr height=21 style=\'height:16.0pt\'>\r\n <td height=21 style=\'height:16.0pt\'></td>\r\n <td></td>\r\n <td></td>\r\n </tr>\r\n <tr height=21 style=\'height:16.0pt\'>\r\n <td height=21 style=\'height:16.0pt\'></td>\r\n <td></td>\r\n <td></td>\r\n </tr>\r\n <tr height=21 style=\'height:16.0pt\'>\r\n <td height=21 style=\'height:16.0pt\'></td>\r\n <td></td>\r\n <td></td>\r\n </tr>\r\n <tr height=21 style=\'height:16.0pt\'>\r\n <td height=21 style=\'height:16.0pt\'></td>\r\n <td></td>\r\n <td></td>\r\n </tr>\r\n <tr height=21 style=\'height:16.0pt\'>\r\n <td height=21 style=\'height:16.0pt\'></td>\r\n <td></td>\r\n <td></td>\r\n <td></td>\r\n </tr>\r\n <tr height=31 style=\'height:23.0pt\'>\r\n <td height=31 style=\'height:23.0pt\' data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;univer&quot;}"\r\n data-sheets-textstyleruns="{&quot;1&quot;:0}{&quot;1&quot;:1,&quot;2&quot;:{&quot;2&quot;:{&quot;1&quot;:2,&quot;2&quot;:14275305},&quot;4&quot;:18,&quot;5&quot;:1,&quot;6&quot;:1}}{&quot;1&quot;:4}"></td>\r\n <td class=xl72 align=right>2024/11/11</td>\r\n <td></td>\r\n <td></td>\r\n </tr>\r\n <tr height=21 style=\'height:16.0pt\'>\r\n <td height=21 style=\'height:16.0pt\'></td>\r\n <td></td>\r\n <td></td>\r\n <td></td>\r\n </tr>\r\n\x3C!--EndFragment-->\r\n</table>\r\n\r\n</body>\r\n\r\n</html>\r\n';
+// copy value is 000123456
+export const excelSample2 = '<html xmlns:o="urn:schemas-microsoft-com:office:office"\r\nxmlns:x="urn:schemas-microsoft-com:office:excel"\r\nxmlns="http://www.w3.org/TR/REC-html40">\r\n\r\n<head>\r\n<meta http-equiv=Content-Type content="text/html; charset=utf-8">\r\n<meta name=ProgId content=Excel.Sheet>\r\n<meta name=Generator content="Microsoft Excel 15">\r\n<link id=Main-File rel=Main-File\r\nhref="file:///C:/Users/26775/AppData/Local/Temp/msohtmlclip1/01/clip.htm">\r\n<link rel=File-List\r\nhref="file:///C:/Users/26775/AppData/Local/Temp/msohtmlclip1/01/clip_filelist.xml">\r\n<style>\r\n\x3C!--table\r\n\t{mso-displayed-decimal-separator:"\\.";\r\n\tmso-displayed-thousand-separator:"\\,";}\r\n@page\r\n\t{margin:.75in .7in .75in .7in;\r\n\tmso-header-margin:.3in;\r\n\tmso-footer-margin:.3in;}\r\n.font5\r\n\t{color:windowtext;\r\n\tfont-size:9.0pt;\r\n\tfont-weight:400;\r\n\tfont-style:normal;\r\n\ttext-decoration:none;\r\n\tfont-family:等线;\r\n\tmso-generic-font-family:auto;\r\n\tmso-font-charset:134;}\r\ntr\r\n\t{mso-height-source:auto;\r\n\tmso-ruby-visibility:none;}\r\ncol\r\n\t{mso-width-source:auto;\r\n\tmso-ruby-visibility:none;}\r\nbr\r\n\t{mso-data-placement:same-cell;}\r\ntd\r\n\t{padding-top:1px;\r\n\tpadding-right:1px;\r\n\tpadding-left:1px;\r\n\tmso-ignore:padding;\r\n\tcolor:black;\r\n\tfont-size:11.0pt;\r\n\tfont-weight:400;\r\n\tfont-style:normal;\r\n\ttext-decoration:none;\r\n\tfont-family:等线;\r\n\tmso-generic-font-family:auto;\r\n\tmso-font-charset:134;\r\n\tmso-number-format:General;\r\n\ttext-align:general;\r\n\tvertical-align:middle;\r\n\tborder:none;\r\n\tmso-background-source:auto;\r\n\tmso-pattern:auto;\r\n\tmso-protection:locked visible;\r\n\twhite-space:nowrap;\r\n\tmso-rotate:0;}\r\n.xl65\r\n\t{mso-number-format:"\\@";}\r\nruby\r\n\t{ruby-align:left;}\r\nrt\r\n\t{color:windowtext;\r\n\tfont-size:9.0pt;\r\n\tfont-weight:400;\r\n\tfont-style:normal;\r\n\ttext-decoration:none;\r\n\tfont-family:等线;\r\n\tmso-generic-font-family:auto;\r\n\tmso-font-charset:134;\r\n\tmso-char-type:none;\r\n\tdisplay:none;}\r\n-->\r\n</style>\r\n</head>\r\n\r\n<body link="#0563C1" vlink="#954F72">\r\n\r\n<table border=0 cellpadding=0 cellspacing=0 width=115 style=\'border-collapse:\r\n collapse;width:86pt\'>\r\n <col width=115 style=\'mso-width-source:userset;mso-width-alt:3680;width:86pt\'>\r\n <tr height=19 style=\'height:14.25pt\'>\r\n\x3C!--StartFragment-->\r\n <td height=19 class=xl65 width=115 style=\'height:14.25pt;width:86pt\'>000123456</td>\r\n\x3C!--EndFragment-->\r\n </tr>\r\n</table>\r\n\r\n</body>\r\n\r\n</html>\r\n';
+
export const googleSample = '<google-sheets-html-origin><style type="text/css">\x3C!--td {border: 1px solid #cccccc;}br {mso-data-placement:same-cell;}--></style><table xmlns="http://www.w3.org/1999/xhtml" cellspacing="0" cellpadding="0" dir="ltr" border="1" style="table-layout:fixed;font-size:10pt;font-family:Arial;width:0px;border-collapse:collapse;border:none" data-sheets-root="1"><colgroup><col width="100"/><col width="100"/><col width="100"/><col width="100"/></colgroup><tbody><tr style="height:21px;"><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td></tr><tr style="height:21px;"><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;font-weight:bold;font-style:italic;" data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Univer&quot;}">Univer</td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;background-color:#ff0000;" data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;univer&quot;}" data-sheets-textstyleruns="{&quot;1&quot;:0}{&quot;1&quot;:1,&quot;2&quot;:{&quot;2&quot;:{&quot;1&quot;:2,&quot;2&quot;:14275305},&quot;4&quot;:18,&quot;5&quot;:1,&quot;6&quot;:1}}{&quot;1&quot;:4}"><span style="font-size:10pt;font-family:Arial;font-style:normal;">u</span><span style="font-size:18pt;font-family:Arial;font-weight:bold;font-style:italic;color:#d9d2e9;">niv</span><span style="font-size:10pt;font-family:Arial;font-style:normal;">er</span></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td></tr><tr style="height:21px;"><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="border-bottom:1px solid #000000;overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="border-bottom:1px solid #000000;overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td></tr><tr style="height:21px;"><td style="border-right:1px solid #000000;overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="border-right:1px solid #000000;border-bottom:1px solid #000000;overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;text-align:center;" rowspan="1" colspan="2" data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;univer&quot;}">univer</td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td></tr><tr style="height:21px;"><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="border-bottom:1px solid #000000;overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="border-bottom:1px solid #000000;overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td></tr><tr style="height:21px;"><td style="border-right:1px solid #000000;overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="border-right:1px solid #000000;border-bottom:1px solid #000000;overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;text-align:center;" rowspan="2" colspan="2" data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;univer&quot;}"><span><div style="max-height:42px">univer</div></span></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td></tr><tr style="height:21px;"><td style="border-right:1px solid #000000;overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td></tr><tr style="height:21px;"><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="border-bottom:1px solid #000000;overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td></tr><tr style="height:21px;"><td style="border-right:1px solid #000000;overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="border-right:1px solid #000000;border-bottom:1px solid #000000;overflow:hidden;padding:2px 3px 2px 3px;vertical-align:middle;background-color:#ff0000;text-align:center;" rowspan="4" colspan="1" data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;univer&quot;}"><span><div style="max-height:84px">univer</div></span></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td></tr><tr style="height:21px;"><td style="border-right:1px solid #000000;overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td></tr><tr style="height:21px;"><td style="border-right:1px solid #000000;overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td></tr><tr style="height:21px;"><td style="border-right:1px solid #000000;overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td></tr><tr style="height:21px;"><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td></tr><tr style="height:21px;"><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;text-align:right;" data-sheets-value="{&quot;1&quot;:3,&quot;3&quot;:45607}" data-sheets-numberformat="{&quot;1&quot;:5,&quot;2&quot;:&quot;yyyy/m/d&quot;,&quot;3&quot;:1}">2024/11/11</td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td></tr><tr style="height:21px;"><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td><td style="overflow:hidden;padding:2px 3px 2px 3px;vertical-align:bottom;"></td></tr></tbody></table>';
// font