spreadJS 14.0.9
场景描述:签章功能,用户点击签章,然后通过异步获取图片后将图片加载到签章的位置
问题描述:同一套代码设置号图片的宽高,发现在不同的spread的尺寸不一样,而且在sheet页上呈现的图片尺寸与代码设置的不一致;
此外,难道行高也对图片高度有影响?图片大小如何固定?
代码如下:
/**
* 签章
* @param {base64} img
* @param {string} field
* @param {object} sheetBindingInfo
*/
signaturePicture(img, field, sheetBindingInfo, sheet) {
let picture = sheet.pictures.add(field,img,10,10,100,50);
// let picture = sheet.pictures.add(field,img);
let row = sheetBindingInfo[field].row, col = sheetBindingInfo[field].col;
let cellInfo = getSpanSizeInfo(sheetBindingInfo[field], sheet);
// let rowOffset = cellInfo.height > 50 ? (cellInfo.height - 50) / 2 : 10;
// let colOffset = cellInfo.width > 100 ? (cellInfo.width - 100) / 2 : 10;
let endRow = cellInfo.rowCount > 1 ? row + cellInfo.rowCount -1 : row + 2;
let endColumn = cellInfo.colCount > 1 ? col + cellInfo.colCount -1 : col + 1;
console.log(`row:${row};endRow:${endRow}`);
picture.width(100);
picture.height(50);
picture.dynamicMove(false);
picture.dynamicSize(false);
picture.startRow(row);
picture.startColumn(col);
picture.endRow(endRow);
picture.endColumn(endColumn);
// picture.startRowOffset(rowOffset);
// picture.endRowOffset(rowOffset);
// picture.startColumnOffset(colOffset);
// picture.endColumnOffset(colOffset);
picture.allowMove(false);
picture.allowResize(false);
// console.log(`row{row},endRow{endRow};col{col},endColumn{endColumn},rowOffset{rowOffset},colOffset{colOffset};sheetName{sheet.name()}`);
// console.log(picture);
},
spreadwork1中的图片信息
spreadwork2中的图片信息
|