Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
fix(bug): bug
Browse files Browse the repository at this point in the history
bug

fix #154, fix #410, fix #416
  • Loading branch information
wpxp123456 committed Jan 6, 2021
1 parent 71ade32 commit 06636f6
Showing 1 changed file with 48 additions and 17 deletions.
65 changes: 48 additions & 17 deletions src/global/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2260,7 +2260,13 @@ export function getRangeArray(dimensional, options = {}) {
for(let r = r1; r <= r2; r++){
for(let c = c1; c <= c2; c++){
let cell = data[r][c];
dataArr.push(cell);

if(cell == null || cell.v == null){
dataArr.push(null);
}
else{
dataArr.push(cell.v);
}
}
}
}
Expand All @@ -2270,7 +2276,13 @@ export function getRangeArray(dimensional, options = {}) {

for(let c = c1; c <= c2; c++){
let cell = data[r][c];
row.push(cell);

if(cell == null || cell.v == null){
row.push(null);
}
else{
row.push(cell.v);
}
}

dataArr.push(row);
Expand Down Expand Up @@ -2732,18 +2744,9 @@ export function setSingleRangeFormat(attr, value, options = {}) {
range = formula.getcellrange(range)
}

let rowCount = range.row[1] - range.row[0] + 1,
columnCount = range.column[1] - range.column[0] + 1;

if (data.length !== rowCount || data[0].length !== columnCount) {
return tooltip.info('The data to be set does not match the selection', '')
}

for (let i = 0; i < rowCount; i++) {
for (let j = 0; j < columnCount; j++) {
let row = range.row[0] + i,
column = range.column[0] + j;
setCellFormat(row, column, attr, value, {order: order})
for (let r = range.row[0]; r <= range.row[1]; r++) {
for (let c = range.column[0]; c <= range.column[1]; c++) {
setCellFormat(r, c, attr, value, {order: order})
}
}
}
Expand All @@ -2766,10 +2769,34 @@ export function setRangeFormat(attr, value, options = {}) {
success
} = {...options}

if (range instanceof Array) {
for (let i = 0; i < range.length; i++) {
setSingleRangeFormat(range[i])
if(getObjType(range) == 'string'){
if(!formula.iscelldata(range)){
return tooltip.info("The range parameter is invalid.", "");
}

let cellrange = formula.getcellrange(range);
range = [{
"row": cellrange.row,
"column": cellrange.column
}]
}
else if(getObjType(range) == 'object'){
if(range.row == null || range.column == null){
return tooltip.info("The range parameter is invalid.", "");
}

range = [{
"row": range.row,
"column": range.column
}];
}

if(getObjType(range) != 'array'){
return tooltip.info("The range parameter is invalid.", "");
}

for (let i = 0; i < range.length; i++) {
setSingleRangeFormat(attr, value, { range: range[i], order: order });
}

if (success && typeof success === 'function') {
Expand Down Expand Up @@ -4765,6 +4792,10 @@ export function setSheetDelete(options = {}) {
return tooltip.info("The order parameter is invalid.", "");
}

if(Store.luckysheetfile.length === 1){
return tooltip.info(locale().sheetconfig.noMoreSheet, "");
}

sheetmanage.deleteSheet(file.index);

setTimeout(() => {
Expand Down

0 comments on commit 06636f6

Please sign in to comment.