NamedRanges changes
This commit is contained in:
committed by
Nicolás Hatcher Andrés
parent
cbda30f951
commit
832ca02e16
@@ -1,6 +1,10 @@
|
||||
import type { Area, Cell } from "./types";
|
||||
|
||||
import { columnNameFromNumber } from "@ironcalc/wasm";
|
||||
import {
|
||||
type SelectedView,
|
||||
type WorksheetProperties,
|
||||
columnNameFromNumber,
|
||||
} from "@ironcalc/wasm";
|
||||
|
||||
/**
|
||||
* Returns true if the keypress should start editing
|
||||
@@ -57,7 +61,24 @@ export function rangeToStr(
|
||||
if (rowStart === rowEnd && columnStart === columnEnd) {
|
||||
return `${sheetName}${columnNameFromNumber(columnStart)}${rowStart}`;
|
||||
}
|
||||
return `${sheetName}${columnNameFromNumber(
|
||||
columnStart,
|
||||
)}${rowStart}:${columnNameFromNumber(columnEnd)}${rowEnd}`;
|
||||
return `${sheetName}${columnNameFromNumber(columnStart)}${rowStart}:${columnNameFromNumber(
|
||||
columnEnd,
|
||||
)}${rowEnd}`;
|
||||
}
|
||||
|
||||
export function getFullRangeToString(
|
||||
selectedView: SelectedView,
|
||||
worksheets: WorksheetProperties[], // solo pasar names
|
||||
): string {
|
||||
// order of values is confusing compared to rangeToStr range type, needs refactoring for consistency
|
||||
const [rowStart, columnStart, rowEnd, columnEnd] = selectedView.range;
|
||||
const sheetNames = worksheets.map((s) => s.name);
|
||||
const sheetName = `${sheetNames[selectedView.sheet]}!`;
|
||||
|
||||
if (rowStart === rowEnd && columnStart === columnEnd) {
|
||||
return `${sheetName}${columnNameFromNumber(columnStart)}${rowStart}`;
|
||||
}
|
||||
return `${sheetName}${columnNameFromNumber(columnStart)}${rowStart}:${columnNameFromNumber(
|
||||
columnEnd,
|
||||
)}${rowEnd}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user