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(conditional-formatting): custom formula rendering error (#2117)

Gpound.liud04a0f8fd496
diff --git a/packages/sheets-conditional-formatting/src/services/conditional-formatting-formula.service.ts b/packages/sheets-conditional-formatting/src/services/conditional-formatting-formula.service.ts
index 6e4b729ed6..69eb45ea33 100644
--- a/packages/sheets-conditional-formatting/src/services/conditional-formatting-formula.service.ts
+++ b/packages/sheets-conditional-formatting/src/services/conditional-formatting-formula.service.ts
@@ -15,7 +15,7 @@
*/
import type { ICellData, Nullable, ObjectMatrix } from '@univerjs/core';
-import { Disposable, ICommandService, RefAlias, toDisposable, Tools } from '@univerjs/core';
+import { BooleanNumber, CellValueType, Disposable, ICommandService, RefAlias, toDisposable, Tools } from '@univerjs/core';
import { Inject, Injector } from '@wendellhu/redi';
import type { IRemoveOtherFormulaMutationParams, ISetFormulaCalculationResultMutation, ISetOtherFormulaMutationParams } from '@univerjs/engine-formula';
import { IActiveDirtyManagerService, RemoveOtherFormulaMutation,
@@ -43,6 +43,9 @@ export enum FormulaResultStatus {
const getResultFromFormula = (formulaResult: Nullable<ICellData>[][]) => {
const v = formulaResult && formulaResult[0] && formulaResult[0][0];
+ if (v?.t === CellValueType.BOOLEAN) {
+ return v.v === BooleanNumber.TRUE || v.v === true;
+ }
return v ? v.v : false;
};
// TODO: @Gggpound