用修改無痕跡模式起草文件,各個領導批註本身意見的時候使用強制留痕模式打開,文員清稿的時候用核稿模式打開,還有最後只讀模式打開發布的正式文件。其中在領導批註環節也演示了PageOffice提供的手寫功能,在文件核稿以後能夠加蓋印章。javascript
<!-- PageOffice Begin --> <servlet> <servlet-name>poserver</servlet-name> <servlet-class>com.zhuozhengsoft.pageoffice.poserver.Server</servlet-class> </servlet> <servlet-mapping> <servlet-name>poserver</servlet-name> <url-pattern>/poserver.zz</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>poserver</servlet-name> <url-pattern>/sealsetup.exe</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>poserver</servlet-name> <url-pattern>/posetup.exe</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>poserver</servlet-name> <url-pattern>/pageoffice.js</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>poserver</servlet-name> <url-pattern>/jquery.min.js</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>poserver</servlet-name> <url-pattern>/pobstyle.css</url-pattern> </servlet-mapping> <servlet> <servlet-name>adminseal</servlet-name> <servlet-class>com.zhuozhengsoft.pageoffice.poserver.AdminSeal</servlet-class> </servlet> <servlet-mapping> <servlet-name>adminseal</servlet-name> <url-pattern>/adminseal.zz</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>adminseal</servlet-name> <url-pattern>/loginseal.zz</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>adminseal</servlet-name> <url-pattern>/sealimage.zz</url-pattern> </servlet-mapping> <mime-mapping> <extension>mht</extension> <mime-type>message/rfc822</mime-type> </mime-mapping> <context-param> <param-name>adminseal-password</param-name> <param-value>111111</param-value> </context-param> <!-- PageOffice End -->
<a href="word.jsp?type=creat">在線編輯</a> → <a href="word.jsp?type=check&user=張三">張三批閱 </a> → <a href="word.jsp?type=check&user=LiSi">李四批閱</a> → <a href="word.jsp?type=accept">文員清稿</a> → <a href="word.jsp?type=publish">正式發文</a>
<%@ page language="java" import="java.util.*,com.zhuozhengsoft.pageoffice.*,com.zhuozhengsoft.pageoffice.wordwriter.*" pageEncoding="UTF-8"%> <%@page import="java.awt.Color"%> <% String type = (String) request.getParameter("type"); String user = (String) request.getParameter("user"); PageOfficeCtrl poCtrl = new PageOfficeCtrl(request); //設置服務器頁面 poCtrl.setServerPage(request.getContextPath() + "/poserver.zz"); //添加自定義按鈕 poCtrl.addCustomToolButton("保存", "Save", 1); poCtrl.addCustomToolButton("全屏/還原", "IsFullScreen", 4); //設置保存頁面 poCtrl.setSaveFilePage("SaveFile.jsp"); if ("creat".equals(type)) { //普通編輯模式打開文檔 打開Word文檔 poCtrl.webOpen("doc/test.doc", OpenModeType.docNormalEdit, "張佚名"); } if ("check".equals(type)) { poCtrl.addCustomToolButton("顯示/隱藏痕跡", "Show_HidRevisions", 5); poCtrl.addCustomToolButton("領導圈閱", "StartHandDraw", 3); poCtrl.addCustomToolButton("插入鍵盤批註", "StartRemark", 3); poCtrl.addCustomToolButton("分層顯示手寫批註", "ShowHandDrawDispBar",7); //強制留痕模式打開文檔 打開Word文檔 poCtrl.webOpen("doc/test.doc", OpenModeType.docRevisionOnly,user); } if ("accept".equals(type)) { poCtrl.addCustomToolButton("顯示/隱藏痕跡", "Show_HidRevisions", 5); poCtrl.addCustomToolButton("插入印章/簽名", "InsertSeal", 2); poCtrl.addCustomToolButton("接受全部修訂", "AcceptAllRevisions", 5); poCtrl .addCustomToolButton("分層顯示手寫批註", "ShowHandDrawDispBar",7); //核稿模式打開文檔 打開Word文檔 poCtrl.webOpen("doc/test.doc", OpenModeType.docAdmin, "張佚名"); } if ("publish".equals(type)) { poCtrl.addCustomToolButton("另存到本地", "ShowDialog(0)", 5); poCtrl.addCustomToolButton("頁面設置", "ShowDialog(1)", 0); poCtrl.addCustomToolButton("打印", "ShowDialog(2)", 6); poCtrl.setMenubar(false); poCtrl.setOfficeToolbars(false); //只讀模式打開文檔 打開Word文檔 poCtrl.webOpen("doc/test.doc", OpenModeType.docReadOnly, "張佚名"); } %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <script type="text/javascript"> //保存 function Save() { document.getElementById("PageOfficeCtrl1").WebSave(); } //全屏/還原 function IsFullScreen() { document.getElementById("PageOfficeCtrl1").FullScreen = !document.getElementById("PageOfficeCtrl1").FullScreen; } //顯示/隱藏痕跡 function Show_HidRevisions() { document.getElementById("PageOfficeCtrl1").ShowRevisions = !document.getElementById("PageOfficeCtrl1").ShowRevisions; } //領導圈閱簽字 function StartHandDraw() { document.getElementById("PageOfficeCtrl1").HandDraw.SetPenWidth(5); document.getElementById("PageOfficeCtrl1").HandDraw.Start(); } // 插入鍵盤批註 function StartRemark() { var appObj = document.getElementById("PageOfficeCtrl1").WordInsertComment(); } //分層顯示手寫批註 function ShowHandDrawDispBar() { document.getElementById("PageOfficeCtrl1").HandDraw.ShowLayerBar(); ; } //接受全部修訂 function AcceptAllRevisions() { document.getElementById("PageOfficeCtrl1").AcceptAllRevisions(); } function ShowDialog(index) { if (index == 0) document.getElementById("PageOfficeCtrl1").ShowDialog(2); if (index == 1) document.getElementById("PageOfficeCtrl1").ShowDialog(5); if (index == 2) document.getElementById("PageOfficeCtrl1").ShowDialog(4); } //插入印章 function InsertSeal(){ try { document.getElementById("PageOfficeCtrl1").ZoomSeal.AddSeal(); } catch(e) {} } </script> </head> <body> <div style="height: 850px; width: 1036px; overflow: hidden;"> <%=poCtrl.getHtmlCode("PageOfficeCtrl1")%> </div> </body> </html>
FileSaver fs=new FileSaver(request,response); fs.saveToFile(request.getSession().getServletContext().getRealPath("doc/")+"/"+fs.getFileName()); fs.close();
(1)此示例演示了簡單的文件流轉,沒有返回. 如需返回從新編輯審閱文檔,能夠寫本身的邏輯css
(2)本示例 用到的印章是pgaeoffice 自帶的簡易印章. 用的是 sqlite 數據庫. 必須複製sqlite 的jar 以及 poseal.db文件. 能夠到http://www.zhuozhengsoft.com/dowm/ 下載試用程序.裏面有對應的文件html