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(render): fixed numbers were not right-aligned by default after applying a number format (#5421)
wpxp12345667cc34ce22f8
diff --git a/packages/engine-render/src/components/sheets/extensions/font.ts b/packages/engine-render/src/components/sheets/extensions/font.tsindex e9c472fa27..9e526add05 100644--- a/packages/engine-render/src/components/sheets/extensions/font.ts+++ b/packages/engine-render/src/components/sheets/extensions/font.ts@@ -482,13 +482,11 @@ export class Font extends SheetExtension {cellWidth = endX - startX - paddingLeft - paddingRight;}- const isNumber = cellData.t === CellValueType.NUMBER && typeof cellData.v === 'number';-Text.drawWith(ctx, {text,fontStyle: fontCache.fontString,warp: wrapStrategy === WrapStrategy.WRAP && vertexAngle === 0,- hAlign: isNumber && fontCache.horizontalAlign === HorizontalAlign.UNSPECIFIED ? HorizontalAlign.RIGHT : fontCache.horizontalAlign,+ hAlign: (cellData.t === CellValueType.NUMBER && fontCache.horizontalAlign === HorizontalAlign.UNSPECIFIED) ? HorizontalAlign.RIGHT : fontCache.horizontalAlign,vAlign: fontCache.verticalAlign,width: cellWidth,height: cellHeight,