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: fixed imported cell value is 001 (#5279)
wpxp123456ba5424ce75da
diff --git a/mockdata/src/sheets/demo/default-workbook-data-demo.ts b/mockdata/src/sheets/demo/default-workbook-data-demo.tsindex 3c4b910183..667ebd2fa9 100644--- a/mockdata/src/sheets/demo/default-workbook-data-demo.ts+++ b/mockdata/src/sheets/demo/default-workbook-data-demo.ts@@ -13974,6 +13974,11 @@ export const DEFAULT_WORKBOOK_DATA_DEMO: IWorkbookData = {},},},+ pwABhz: {+ n: {+ pattern: 'General',+ },+ },},appVersion: '3.0.0-alpha',sheets: {@@ -14495,6 +14500,14 @@ export const DEFAULT_WORKBOOK_DATA_DEMO: IWorkbookData = {s: 'idtqdi',},},+ 26: {+ // example of a cell imported from excel, which should display as 001+ 0: {+ v: '001',+ t: 1,+ s: 'pwABhz',+ },+ },},freeze: {diff --git a/packages/sheets-numfmt/src/controllers/numfmt-cell-content.controller.ts b/packages/sheets-numfmt/src/controllers/numfmt-cell-content.controller.tsindex 3f5a2fcae5..9fd61082fe 100644--- a/packages/sheets-numfmt/src/controllers/numfmt-cell-content.controller.ts+++ b/packages/sheets-numfmt/src/controllers/numfmt-cell-content.controller.ts@@ -128,7 +128,9 @@ export class SheetsNumfmtCellContentController extends Disposable {numfmtValue = this._numfmtService.getValue(unitId, sheetId, location.row, location.col);}- if (!numfmtValue) {+ // If the cell is not formatted, or the format is 'General', do not process it+ // e.g. { v: '001', t: 1, s: { n: { pattern: 'General' } } } should display as '001'+ if (!numfmtValue || numfmtValue.pattern === 'General') {return next(cell);}