您好,您是在templateSheet中设置了tag ,然后在预览模式下,点击任意一个单元格 ,获取此单元格在templateSheet的模板单元格中保存的tag吗?
如果是此需求:
您可以按照下面的代码进行设置,先设置setTag
然后获取tag
- document.querySelector(".btn1").addEventListener("click", () => {
- const reportSheet = spread.getActiveSheetTab()
- const templateSheet = reportSheet.getTemplate()
- var activeCellRow = reportSheet.getSheet().getActiveRowIndex();
- var activeCellColumn = reportSheet.getSheet().getActiveColumnIndex();
- const designTemplateCell1 = reportSheet.getTemplateCell(activeCellRow, activeCellColumn)
- let usedRange = templateSheet.getUsedRange(GC.Spread.Sheets.UsedRangeType.all)
- const {row,col,rowCount,colCount} = usedRange
- for(let r = row;r<row+rowCount;r++){
- for(let c = col;c<col+colCount;c++){
- let templateCell = templateSheet.getTemplateCell(r,c);
- if(templateCell && templateCell.binding==designTemplateCell1.binding){
- console.log(templateSheet.getTag(r,c))
- }
- }
- }
- })
复制代码 结果如下:
附件如下:
tag.html
(5.93 KB, 下载次数: 2)
|