word.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <script type="text/javascript" src="http://47.99.98.85:8232/JavaBridge/pageoffice.js"></script>
  2. <?php
  3. header("Content-type:text/html; charset=utf-8");//设置当前页面编码为“utf-8”
  4. ini_set("display_errors","On");
  5. error_reporting(E_ALL);
  6. $ip = GetHostByName($_SERVER['SERVER_NAME']); //获取本机IP
  7. //******************************卓正PageOffice组件的使用*******************************
  8. require_once("http://".$ip.":8232/JavaBridge/java/Java.inc");//此行必须
  9. $PageOfficeCtrl = new Java("com.zhuozhengsoft.pageoffice.PageOfficeCtrlPHP");//此行必须
  10. $PageOfficeCtrl->setServerPage("http://".$ip.":8232/JavaBridge/poserver.zz");//此行必须,设置服务器页面
  11. //添加自定义按钮
  12. $PageOfficeCtrl->addCustomToolButton("保存","Save",1);
  13. $PageOfficeCtrl->addCustomToolButton("打印设置","PrintSet",0);
  14. $PageOfficeCtrl->addCustomToolButton("打印","PrintFile",6);
  15. $PageOfficeCtrl->addCustomToolButton("全屏/还原", "IsFullScreen", 4);
  16. $PageOfficeCtrl->addCustomToolButton("-", "", 0);
  17. $PageOfficeCtrl->addCustomToolButton("关闭","Close",21);
  18. //设置保存页面
  19. $PageOfficeCtrl->setSaveFilePage("./SaveFile.php");
  20. //打开excel文档
  21. $PageOfficeCtrl->UserAgent = $_SERVER['HTTP_USER_AGENT'];//若使用谷歌浏览器此行代码必须有,其他浏览器此行代码可不加
  22. $OpenMode = new Java("com.zhuozhengsoft.pageoffice.OpenModeType");
  23. $PageOfficeCtrl->webOpen($_GET['doc'], $OpenMode->docNormalEdit, "张三");//此行必须
  24. ?>
  25. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  26. <html>
  27. <head>
  28. <title>卷烟包装材料安全卫生检 测 报 告-浙江美浓世纪集团有限公司检测中心</title>
  29. </head>
  30. <body>
  31. <script type="text/javascript">
  32. function Save() {
  33. document.getElementById("PageOfficeCtrl1").WebSave();
  34. }
  35. function PrintSet() {
  36. document.getElementById("PageOfficeCtrl1").ShowDialog(5);
  37. }
  38. function PrintFile() {
  39. document.getElementById("PageOfficeCtrl1").ShowDialog(4);
  40. }
  41. function Close() {
  42. //alert(document.getElementById("PageOfficeCtrl1").Document.ProtectionType );
  43. window.external.close();
  44. }
  45. function IsFullScreen() {
  46. document.getElementById("PageOfficeCtrl1").FullScreen = !document.getElementById("PageOfficeCtrl1").FullScreen;
  47. }
  48. //文档关闭前先提示用户是否保存
  49. function BeforeBrowserClosed(){
  50. if (document.getElementById("PageOfficeCtrl1").IsDirty){
  51. if(confirm("提示:文档已被修改,是否继续关闭放弃保存 ?"))
  52. {
  53. return true;
  54. }else{
  55. return false;
  56. }
  57. }
  58. }
  59. </script>
  60. <form id="form1" >
  61. <div style=" width:auto; height:700px;">
  62. <?php echo $PageOfficeCtrl->getDocumentView("PageOfficeCtrl1") ?>
  63. </div>
  64. </form>
  65. </body>
  66. </html>