Foxtable(狐表)用户栏目专家坐堂 → excel无法加密


  共有3333人关注过本帖树形打印复制链接

主题:excel无法加密

帅哥哟,离线,有人找我吗?
rjh4078
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐精 帖子:3375 积分:24904 威望:0 精华:0 注册:2012/3/26 21:47:00
excel无法加密  发帖心情 Post By:2021/3/13 21:05:00 [只看该作者]

Dim lj As String=Functions.Execute("获取模板文件")
If lj<>"" Then
    Dim Book As New XLS.Book(lj)
    Dim Ifo As new FileInfo(lj)
    Dim sr As String
    sr=Ifo.Name.Replace(Ifo.Extension,"")
    lj=lj.Replace(sr,rwh)
    Dim fl As String =lj.Replace("Attachments","Reports")
    book.AddDataTable("gd","cderp","Sel ect * from {gd} a where gdno='" & rwh & "'" )
    book.AddDataTable("gddd","cderp","Se lect * from {gddd} a  inner join " & _
    "(Sel ect gdno,加工type,QC要求,送货方式,包装方式,首件确认,制单人,审核人,gdtype from gd) b on a.gdno=b.gdno" & _
    " inner join  (sel ect 分支机构,khno as kh from cuinfo ) c on  c.kh=a.khno" & _
    " where a.gdno='" & rwh & "'" )
    book.AddDataTable("gdysdetails","cderp","sel ect * from gdysdetails a left join (sel ect gdno,prid,材料count as 用料数 from gd用料明细) b on a.prid=b.prid and a.gdno=b.gdno " & _
    "  left join (sel ect guid,count as CTPcount from gdgx where gx='CTP') d on  a.prid=d.guid  where  a.gdno='" & rwh & "'")
    book.AddDataTable("gdgx","cderp","Sel ect * from {gdgx} a where gdno='" & rwh & "'" )
    
    book.AddRelation("gd","gdno","gddd","gdno")
    book.AddRelation("gd","gdno","gdysdetails","gdno")
    book.AddRelation("gd","gdno","gdgx","gdno")
    
    Book.Build() '生成细节区
    Book.Save(fl)
    
  Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(fl)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Ws.Protect(Password:=Format(Date.now,"yyMMdd"))
Wb.Save
App.Visible = True

将报表生成好,单独使用加密代码也是无法加密:现象都是部分单元格加密,部分没加密,office版本是 office365.

Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(ProjectPath & "reports\订单.xlsx")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Ws.Protect(Password:="foxtabletest")

Wb.Save

App.Visible = True


[此贴子已经被作者于2021/3/13 21:19:34编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:111414 积分:567140 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/3/14 20:20:00 [只看该作者]

没有office365,安装的是office2013,测试没有问题。看明天用公司电脑试试

 回到顶部