如何將SAP Document Builder的word控制元件設定成只讀模式
Recently I am working on a customer project and one customer requirement is they do not want to the word document be editable in the word control.
That means all buttons and menus in toolbar should be disabled.
The first idea comes to my mind is the flag “enableReadWrite“.
As documented in sap help,it can fulfill my help but unfortunately it is deprecated. Regardless of this warning I have a try and found it does not work indeed.
Then I am speculating that if the document uploaded is read only, it is for sure that the toolbar will be disabled. So the issue turns to that how could I mark the document to be read only on the fly during uploading.
Since word 2007 the format of MS office follows the so called “Open office” protocol whose specification could be found
here.
If you change the file type extension from .docx to .zip and open it with WinRAR, you will find the document is actually a bundle of several single files ( called document part in SAP internal ). The editability is controlled within the file settings.xml.
If you don’t know the exact syntax, just google it. I use the explanation from this one in google:
Now the task is quite easy, just add the necessary xml tag into the document source code. You do not need to manually parse the document source code since SAP has already done this job. You can just reuse standard class CL_DOCX_DOCUMENT.
Since I need to insert the document protection node in “settings” node, a simple transformation is written for this. The magic is between line 18 and 21.
and find a proper place to call the transformation:
after that the tag will be there in settings.xml:
The word control before upload document looks like below, buttons and menus available:
After upload, menu and button are disabled. If you try to edit the document, there will be notifications in the right pane to give you a hint that is not possible.
Of course this solution does not work for lower version of MS word like word2003. Fortunately my customer has enough money and they are already using Office 2013 so I do not need to worry about it.
要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2708659/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 如何將表單元素設定為只讀狀態
- word只讀文件怎麼改成可編輯文件 word檔案怎樣取消只讀模式模式
- SAP document builder一些常見問題的解答UI
- comboBox設定為只讀(只選)
- 如何將Word文件轉成Excel表格?Excel
- easyui datebox 設定只讀UI
- JavaScript設定input文字框只讀JavaScript
- 設定input文字框只讀效果
- word檔案怎樣取消只讀模式 把只讀檔案轉化為可編輯檔案模式
- 文件被鎖定以只讀模式開啟怎麼取消 檔案只讀模式怎麼解除模式
- word相容模式怎樣換成正常模式 如何把word相容模式改成標準模式
- 設定document物件的高度物件
- Builder設計模式UI設計模式
- WebBrowser 控制元件設計模式設定Web控制元件設計模式
- 設計模式:Builder模式概述設計模式UI
- MySQL設定資料庫為只讀MySql資料庫
- word多級列表如何自動設定 word多級列表設定的步驟
- word藝術字型如何設定?
- Java設計模式之builder模式Java設計模式UI
- 設計模式-建造者模式(Builder)設計模式UI
- 如何將SAP WebClient UI的表格匯出成PDFWebclientUI
- 如何將檔案PDF格式轉換成Word格式
- SAP Gateway Service Builder 裡的 OData Model 定義方式GatewayUI
- 將textarea文字框設定為只讀和不可用簡單介紹
- JavaScript 動態設定input文字框只讀JavaScript
- 表單元素設定為只讀狀態
- word分欄怎麼設定 word設定分欄的方法
- word底紋怎麼設定 設定word底紋的方法
- 直播網站程式原始碼,【openpyxl】只讀模式、只寫模式網站原始碼模式
- 設計模式-生成器模式Builder設計模式UI
- 【設計模式】- 生成器模式(Builder)設計模式UI
- 設計模式--建造者模式(Builder Pattern)設計模式UI
- 【設計模式筆記】(二)- Builder模式設計模式筆記UI
- Java設計模式----建造者模式(Builder)Java設計模式UI
- 設計模式之-建造者模式-Builder設計模式UI
- 設計模式Builder之惑設計模式UI
- 菜鳥成長系列-Builder 建造者模式UI模式
- 設定select下拉選單readonly只讀