廢話不多說。工作接觸到的,其中也是踩了許多坑。總結了17個ntko相關的使用方法。
先介紹一個網站:http://dev.ntko.com:8000/ ntko官方的技術文檔。雖有東西都比較老,但有時候還是能幫不少忙得
以前代碼 this.ntkoApp 就是ntko<object>的對象
1.打開遠程文檔
this.ntkoApp.OpenFromURL(文件地址);
2.保存到遠程服務器
this.ntkoApp.SaveToURL(服務器地址, 參數1, "",文件名字, '', true)
這里打個重點:網上對於ntko的保存到后台的代碼特別少,自己也是一直摸索才成功的。java后台可以采用post請求,文件流用 MultipartFile 對象接受。其中key值與參數1對應(這里當初坑我一把)
3.文檔顯示比列
this.ntkoApp.ActiveDocument.ActiveWindow.ActivePane.View.Zoom.Percentage = 75;
4.設置只讀
this.ntkoApp.SetReadOnly(true);
5.關閉導航條
this.ntkoApp.ActiveDocument.ActiveWindow.DocumentMap = false;
6.控制是否進入修訂模式
this.ntkoApp.ActiveDocument.TrackRevisions = true;
7.控制是否顯示修訂
this.ntkoApp.ActiveDocument.ShowRevisions = true;
8.接受顯示的修訂
this.ntkoApp.ActiveDocument.AcceptAllRevisionsShown();
9.拒絕修訂
this.ntkoApp.ActiveDocument.RejectAllRevisions();
10.獲取所有的修訂內容
let reviewers = this.ntkoApp.ActiveDocument.Revisions;
11.獲取修訂內容的作者
可以循環上面的所有修訂內容,獲取單個的修訂人。重點:循環索引從1開始
let reviewer = reviewers.Item(i).Author;
12.禁用修訂內容(根據名字)
this.ntkoApp.ActiveDocument.ActiveWindow.View.Reviewers(name).Visible = false;
13.獲取所有的批注信息數量
let commentCount = document.Comments.Count;
14.根據索引獲取單個批注信息
重點:循環從1開始
let comment = document.Comments(i);
15.刪除批注信息
comment.Delete();
16.根據人禁用修訂信息
let ress = this.ntkoApp.ActiveDocument.Revisions;
this.ntkoApp.ActiveDocument.ActiveWindow.View.Reviewer.Item(ress.Item(i).Author).Visible = false;
17.設置修訂的顯示模式
①原始版本 flag=false,num=1
this.ntkoApp.ActiveDocument.Application.ActiveWindow.View.ShowRevisionsAndComments = flag;
this.ntkoApp.ActiveDocument.Application.ActiveWindow.View.RevisionsView = num;
②所有標記 flag = true,num = 0