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: calc repeats error (#1183)

YuHong2522d378ff70
diff --git a/packages/sheets-ui/src/services/auto-fill/tools.ts b/packages/sheets-ui/src/services/auto-fill/tools.ts
index a4e8c0b84c..d4e6fa3a5a 100644
--- a/packages/sheets-ui/src/services/auto-fill/tools.ts
+++ b/packages/sheets-ui/src/services/auto-fill/tools.ts
@@ -654,7 +654,7 @@ export function getAutoFillRepeatRange(sourceRange: IRange, targetRange: IRange)
if (direction === Direction.DOWN || direction === Direction.UP) {
const sourceLength = sourceRange.endRow - sourceRange.startRow + 1;
const targetLength = targetRange.endRow - targetRange.startRow + 1;
- const mod = targetLength / sourceLength;
+ const mod = Math.floor(targetLength / sourceLength);
const rest = targetLength % sourceLength;
const relativeRange = {
startRow: 0,
@@ -715,7 +715,7 @@ export function getAutoFillRepeatRange(sourceRange: IRange, targetRange: IRange)
if (direction === Direction.RIGHT || direction === Direction.LEFT) {
const sourceLength = sourceRange.endColumn - sourceRange.startColumn + 1;
const targetLength = targetRange.endColumn - targetRange.startColumn + 1;
- const mod = targetLength / sourceLength;
+ const mod = Math.floor(targetLength / sourceLength);
const rest = targetLength % sourceLength;
const relativeRange = {
startRow: 0,