找回密码
 立即注册

QQ登录

只需一步,快速开始

coolmayi
注册会员   /  发表于:2017-2-28 16:45  /   查看:3619  /  回复:5
本帖最后由 coolmayi 于 2017-3-2 12:33 编辑

sheet是setIsProtected(true


var comment = new GcSpread.Sheets.Comment()
comment.text(commentValue)
comment.backColor("yellow")
comment.foreColor("green")
comment.locked(
true)
comment.lockText(true)
comment.displayMode(GcSpread.Sheets.DisplayMode.HoverShown)
sheet.setComment(row, col, comment);

locked 和 lockText都没有效果呢,文本不让编辑,但是可以调整大小。有办法搞吗?

5 个回复

倒序浏览
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-2-28 17:14:57
沙发
不填编辑和调整大小,都需要设置sheet protect 为true才能生效。
回复 使用道具 举报
coolmayi
注册会员   /  发表于:2017-2-28 17:48:31
板凳
dexteryao 发表于 2017-2-28 17:14
不填编辑和调整大小,都需要设置sheet protect 为true才能生效。

    sheet.setIsProtected(true)
    _forEach(selList, (point) => {
      const {col, row} = point
      const comment = new GcSpread.Sheets.Comment()
      comment.text(commentValue)
      comment.backColor('yellow')
      comment.foreColor('green')
      comment.locked(false)
      comment.lockText(false)
      comment.displayMode(GcSpread.Sheets.DisplayMode.HoverShown)
      sheet.setComment(row, col, comment)
    })
    sheet.setIsProtected(true)


设置了也是可以编辑呢。
回复 使用道具 举报
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-3-1 09:26:24
地板
您在这个页面测试下
http://demo.gcpowertools.com.cn/ ... es/customizeComment


      comment.locked(false) 这个要设置成true
回复 使用道具 举报
coolmayi
注册会员   /  发表于:2017-3-1 15:36:23
5#
dexteryao 发表于 2017-3-1 09:26
您在这个页面测试下
http://demo.gcpowertools.com.cn/SpreadJS/TutorialSampleV9/#/samples/customizeCom ...

上面那个网页下是可以的。
我本地用的V9,有关系吗?

还有怎么删除批注信息?
看到有说明 sheet.comments.remove(5, 5);
但是我本地sheet.comments的undefined的。
回复 使用道具 举报
dexteryao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-3-1 16:55:11
6#
V9和V10的代码有些差异,我给你的链接就是V9的

删除comment 直接设置 undefined就好了, comments 是V10的属性
activeSheet.setComment(5,5,undefined);
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部