找回密码
 立即注册

QQ登录

只需一步,快速开始

哗啦啦

注册会员

1

主题

4

帖子

11

积分

注册会员

积分
11
  • 31

    金币

  • 1

    主题

  • 4

    帖子

最新发帖
哗啦啦
注册会员   /  发表于:2024-6-4 10:20  /   查看:508  /  回复:5
10金币
本帖最后由 哗啦啦 于 2024-6-4 10:31 编辑

【可以粘贴图片,但是图片无法被选中,无法被删除】

我想把表格中粘贴进去的图片能选中 然后删除
下面是我的程序粘贴进去的
图片以html 的节点行是存在的
图片无法被选中
image.png848575439.png

这个是代码
image.png578597411.png


看到官网上的案例是图片是canvas中的一个元素 而非html的节点

最佳答案

查看完整内容

您好,这是因为您的表单是被保护的状态,且没有勾选这个选项,导致图片对象无法被拖动,勾选上后重新保护即可: 对应的接口为:https://demo.grapecity.com.cn/spreadjs/help/api/interfaces/GC.Spread.Sheets.IProtectionOptions#alloweditobjects

5 个回复

倒序浏览
最佳答案
最佳答案
Joestar.XuSpreadJS 开发认证
超级版主   /  发表于:2024-6-4 10:20:10
来自 7#
您好,这是因为您的表单是被保护的状态,且没有勾选这个选项,导致图片对象无法被拖动,勾选上后重新保护即可:

image.png149792784.png

对应的接口为:https://demo.grapecity.com.cn/sp ... ns#alloweditobjects
回复 使用道具 举报
哗啦啦
注册会员   /  发表于:2024-6-4 10:24:55
2#
  1. [code] designerInitialized() {
  2.             this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
  3.                 if (typeof (item.name) === 'string') {
  4.                     return !(item.name.includes('pasteOptions'))
  5.                 }
  6.             })
  7.             this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
  8.                 if (typeof (item.name) === 'string') {
  9.                     return !(item.name.includes('pasteAll'))
  10.                 }
  11.             })
  12.             this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
  13.                 if (typeof (item.name) === 'string') {
  14.                     return !(item.name.includes('pasteFormula'))
  15.                 }
  16.             })
  17.             this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
  18.                 if (typeof (item.name) === 'string') {
  19.                     return !(item.name.includes('pasteFormatting'))
  20.                 }
  21.             })
  22.             this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
  23.                 if (typeof (item.name) === 'string') {
  24.                     return !(item.name.includes('pasteValues') && !item.name.includes('pasteValuesFormatting'))
  25.                 }
  26.             })
  27.             this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
  28.                 if (typeof (item.name) === 'string') {
  29.                     return !(item.name.includes('pasteFormulaFormatting'))
  30.                 }
  31.             })
  32.             this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
  33.                 if (typeof (item.name) === 'string') {
  34.                     return !(item.name.includes('insertSheet'))
  35.                 }
  36.             })
  37.             this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
  38.                 if (typeof (item.name) === 'string') {
  39.                     return !(item.name.includes('hideSheet'))
  40.                 }
  41.             })
  42.             this.spread.contextMenu.menuData = this.spread.contextMenu.menuData.filter((item) => {
  43.                 if (typeof (item.name) === 'string') {
  44.                     return !(item.name.includes('deleteSheet'))
  45.                 }
  46.             })
  47.             // console.log('this.spread.contextMenu.menuData11', this.spread.contextMenu.menuData)

  48.             this.spread.contextMenu.menuData.forEach(item => {
  49.                 if (item.name.includes('pasteValuesFormatting')) {
  50.                     item.text = '粘贴'
  51.                 }
  52.             })
  53.             var fbx = new GC.Spread.Sheets.FormulaTextBox.FormulaTextBox(document.getElementById('formulaBox'))
  54.             new GC.Spread.Sheets.NameBox.NameBox('addressBox', this.spread)
  55.             fbx.workbook(this.spread)
  56.             // 阻止用户重命名sheet
  57.             this.spread.options.tabEditable = false
  58.             // 阻止用户添加表单
  59.             this.spread.options.newTabVisible = false
  60.             this.spread.options.scrollByPixel = true
  61.             // 楷体
  62.             registerServerFont('楷体', 'normal', './fonts_grapecity/simkai.ttf')
  63.             registerServerFont('Calibri', 'normal', './fonts_grapecity/calibri.ttf')
  64.             registerServerFont('Cambria', 'normal', './fonts_grapecity/cambriab.ttf')
  65.             // 默认导出宋体
  66.             registerFallbackFont('./fonts_grapecity/songti.ttf')
  67.             this.spread.options.grayAreaBackColor = 'white'
  68.             // 查询或报送管理 或财务三大报表跳转而来
  69.             if (this.$route.query.pageId || this.$route.query.itype) {
  70.                 this.viewReport()
  71.             } else {
  72.                 this.onloadGetdata()
  73.             }
  74.             this.spread.bind(GC.Spread.Sheets.Events.ColumnChanged, (e, info) => {
  75.                 this.isFileModified = true
  76.             })

  77.             this.spread.bind(GC.Spread.Sheets.Events.RowChanged, (e, info) => {
  78.                 this.isFileModified = true
  79.             })
  80.             // 去掉监测活动表单
  81.             // this.spread.bind(GC.Spread.Sheets.Events.SheetChanged, (e, info) => {
  82.             //     this.isFileModified = true
  83.             // })

  84.             this.spread.bind(GC.Spread.Sheets.Events.RowHeightChanged, (e, info) => {
  85.                 this.isFileModified = true
  86.             })

  87.             this.spread.bind(GC.Spread.Sheets.Events.ColumnWidthChanged, (e, info) => {
  88.                 this.isFileModified = true
  89.             })
  90.             this.spread.bind(GC.Spread.Sheets.Events.ActiveSheetChanging, (sender, args) => {
  91.                 this.$refs.popbox.style.display = 'none'
  92.             })
  93.             this.spread.bind(GC.Spread.Sheets.Events.EditChange, (sender, args) => {
  94.                 this.cellValue = args.editingText
  95.             })
  96.             this.spread.bind(GC.Spread.Sheets.Events.TopRowChanged, (sender, args) => {
  97.                 this.$refs.popbox.style.display = 'none'
  98.             })
  99.             this.spread.bind(GC.Spread.Sheets.Events.LeftColumnChanged, (sender, args) => {
  100.                 this.$refs.popbox.style.display = 'none'
  101.             })
  102.             this.spread.bind(GC.Spread.Sheets.Events.EditStarting, (s, e) => {
  103.                 if (this.paramdatainput && this.paramdatainput === '1') {
  104.                     const sheet = e.sheet; const row = e.row; const col = e.col; const cell = sheet.getCell(row, col)
  105.                     const formula = cell.formula()
  106.                     if (formula) {
  107.                         // const tag = cell.tag() || {}
  108.                         // tag.formula = formula
  109.                         cell.formula(undefined)
  110.                         // cell.tag(tag)
  111.                         sheet.startEdit()
  112.                     }
  113.                 }
  114.             })
  115.             this.spread.bind(GC.Spread.Sheets.Events.ActiveSheetChanged, (s, e) => {
  116.                 this.cellValue = this.getActiveCellInfo(this.spread)
  117.             })
  118.             // 监听键盘上下左右 动态显示单元格值
  119.             this.spread.bind(GC.Spread.Sheets.Events.SelectionChanged, async(e, info) => {
  120.                 console.log('SelectionChanged')
  121.                 const args = info.newSelections[0]
  122.                 const sheetnow = info.sheet
  123.                 const sheetname = info.sheetName
  124.                 this.cellValue = this.getActiveCellInfo(this.spread)
  125.                 var deletedCellFormula = ''
  126.                 this.workSheetAllFormulaCells.forEach(item => {
  127.                     if (item.irow === args.row && item.icol === args.col && item.csheetName === sheetname) {
  128.                         deletedCellFormula = item.cformula
  129.                     }
  130.                 })
  131.                 if (sheetnow.hasFormula(args.row, args.col) || deletedCellFormula) {
  132.                     const formula = sheetnow.getFormula(args.row, args.col) || deletedCellFormula
  133.                     this.formulatype = formula.slice(0, 4)
  134.                     var positionInfo = sheetnow.getCellRect(args.row, args.col)
  135.                     this.$refs.popbox.style.top = this.showBtn ? positionInfo.y + 98 + (positionInfo.height) / 2 + 'px' : positionInfo.y + 22 + (positionInfo.height) / 2 + 'px'
  136.                     this.$refs.popbox.style.left = positionInfo.x + positionInfo.width + 19 + 'px'
  137.                     var isShow = formula.includes('ACCT') || formula.includes('XJLL') || formula.includes('VOUCHERACCT') || formula.includes('REF')
  138.                     if (!isShow) {
  139.                         this.$refs.popbox.style.display = 'none'
  140.                         return
  141.                     }
  142.                     this.$refs.popbox.style.display = 'block'
  143.                     if (sheetnow.toJSON().names) {
  144.                         var names = sheetnow.toJSON().names
  145.                         // 获取单元格设置的名称管理器
  146.                         for (var i = 0; i < names.length; i++) {
  147.                             if (Number(names[i].row) === args.row && Number(names[i].col) === args.col) {
  148.                                 this.cformulaname = names[i].name
  149.                             }
  150.                         }
  151.                     }
  152.                     const data = {
  153.                         corgnid: this.cjoborgnid,
  154.                         creportid: this.creportid,
  155.                         creporthistoryid: this.creporthistoryid,
  156.                         ctype: '1',
  157.                         cell: {
  158.                             csheetname: args.sheetName,
  159.                             cformulaname: this.cformulaname,
  160.                             cformula: sheetnow.getFormula(args.row, args.col) || deletedCellFormula
  161.                         },
  162.                         iperiodclass: this.iperiodclassUsedByipeiodchanged,
  163.                         iyear: this.yearValue,
  164.                         iperiod: Number(this.iperiod),
  165.                         iendperiod: Number(this.iendperiod),
  166.                         include: this.iincludeaccount ? 1 : 0,
  167.                         idigits: this.decimalNumber
  168.                     }
  169.                     this.fullscreenLoading_popbox = true
  170.                     await viewsourse(data).then(res => {
  171.                         if (this.cformulaname === data.cell.cformulaname) {
  172.                             this.fullscreenLoading_popbox = false
  173.                             this.sourcedata = res
  174.                         }
  175.                     })
  176.                 } else {
  177.                     this.$refs.popbox.style.display = 'none'
  178.                 }
  179.             })
  180.         },
复制代码
[/code]

回复 使用道具 举报
Joestar.XuSpreadJS 开发认证
超级版主   /  发表于:2024-6-4 18:01:24
3#
您好,我看了一下您提供的代码,没有发现明显的错误会导致这个问题,还需要您提供一下相关的JSON,这边本地测试一下看看是否和JSON相关,或者直接提供一个可以复现此问题的Demo,只要能够复现就行。
回复 使用道具 举报
哗啦啦
注册会员   /  发表于:2024-6-6 10:04:46
5#

谢谢您 附件中就是json的数据

json.zip

8.09 KB, 下载次数: 47

【16.2.5】可以粘贴图片,但是图片无法被选中,无法被删除

回复 使用道具 举报
哗啦啦
注册会员   /  发表于:2024-6-6 10:15:08
6#
Joestar.Xu 发表于 2024-6-4 18:01
您好,我看了一下您提供的代码,没有发现明显的错误会导致这个问题,还需要您提供一下相关的JSON,这边本地 ...

谢谢您 json的数据在附件中

json.zip

8.09 KB, 下载次数: 52

【16.2.5】可以粘贴图片,但是图片无法被选中,无法被删除

回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部