Przeglądaj źródła

Merge branch 'fix/document_templete_editor' into 'develop'

Merge of fix/document_templete_editor to develop 版式正文word转换增加页码

See merge request o2oa/o2oa!1063
胡起 5 lat temu
rodzic
commit
57edb0d5b6

+ 98 - 0
o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/header.htm

@@ -0,0 +1,98 @@
+<html xmlns:v="urn:schemas-microsoft-com:vml"
+      xmlns:o="urn:schemas-microsoft-com:office:office"
+      xmlns:w="urn:schemas-microsoft-com:office:word"
+      xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
+      xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+    <meta http-equiv=Content-Type content="text/html; charset=gb2312">
+    <meta name=ProgId content=Word.Document>
+    <meta name=Generator content="Microsoft Word 15">
+    <meta name=Originator content="Microsoft Word 15">
+    <!--[if gte mso 9]><xml>
+    <o:shapedefaults v:ext="edit" spidmax="2049"/>
+</xml><![endif]-->
+    <style>
+        p.MsoFooter, li.MsoFooter, div.MsoFooter
+        {mso-style-unhide:no;
+            margin:0cm;
+            margin-bottom:.0001pt;
+            mso-pagination:none;
+            tab-stops:center 207.65pt right 415.3pt;
+            layout-grid-mode:char;
+            font-size:9.0pt;
+            font-family:"Times New Roman",serif;
+            mso-fareast-font-family:ËÎÌå;
+            mso-font-kerning:1.0pt;}
+    </style>
+</head>
+
+<body lang=ZH-CN link=blue vlink=purple>
+
+<div style='mso-element:footnote-separator' id=fs>
+
+    <p class=MsoNormal><span lang=EN-US><span style='mso-special-character:footnote-separator'><![if !supportFootnotes]>
+
+<hr align=left size=1 width="33%">
+
+<![endif]></span></span></p>
+
+</div>
+
+<div style='mso-element:footnote-continuation-separator' id=fcs>
+
+    <p class=MsoNormal><span lang=EN-US><span style='mso-special-character:footnote-continuation-separator'><![if !supportFootnotes]>
+
+<hr align=left size=1>
+
+<![endif]></span></span></p>
+
+</div>
+
+<div style='mso-element:endnote-separator' id=es>
+
+    <p class=MsoNormal><span lang=EN-US><span style='mso-special-character:footnote-separator'><![if !supportFootnotes]>
+
+<hr align=left size=1 width="33%">
+
+<![endif]></span></span></p>
+
+</div>
+
+<div style='mso-element:endnote-continuation-separator' id=ecs>
+
+    <p class=MsoNormal><span lang=EN-US><span style='mso-special-character:footnote-continuation-separator'><![if !supportFootnotes]>
+
+<hr align=left size=1>
+
+<![endif]></span></span></p>
+
+</div>
+
+<div style='mso-element:footer' id='ef1'>
+    <p class=MsoFooter style='margin-left:17.85pt;mso-para-margin-left:1.7gd'><span class=MsoPageNumber><span style='font-size:14.0pt;font-family:ËÎÌå'>£­</span></span>
+        <!--[if supportFields]><span class=MsoPageNumber><span lang=EN-US style='font-size:14.0pt;font-family:ËÎÌå'>
+            <span style='mso-element:field-begin'></span> PAGE <span style='mso-element:field-separator'></span></span>
+        </span><![endif]-->
+        <span class=MsoPageNumber><span lang=EN-US style='font-size:14.0pt;font-family:ËÎÌå'>
+            <span style='mso-no-proof:yes'>2</span></span>
+        </span>
+        <!--[if supportFields]><span class=MsoPageNumber><span lang=EN-US style='font-size:14.0pt;font-family:ËÎÌå'><span style='mso-element:field-end'></span></span></span><![endif]-->
+        <span class=MsoPageNumber><span style='font-size:14.0pt;font-family:ËÎÌå'>£­</span></span><span lang=EN-US style='font-family:ËÎÌå'><o:p></o:p></span>
+    </p>
+</div>
+
+<div style='mso-element:footer' id='f1'>
+    <p class=MsoFooter align=right style='margin-right:19.1pt;mso-para-margin-right:1.82gd;text-align:right'><span class=MsoPageNumber><span style='font-size:14.0pt;font-family:ËÎÌå'>£­</span></span>
+        <!--[if supportFields]><span class=MsoPageNumber><span lang=EN-US style='font-size:14.0pt;font-family:ËÎÌå'><span style='mso-element:field-begin'></span> PAGE <span style='mso-element:field-separator'></span></span></span><![endif]-->
+        <span class=MsoPageNumber>
+            <span lang=EN-US style='font-size:14.0pt;font-family:ËÎÌå'><span style='mso-no-proof:yes'>1</span></span>
+        </span>
+        <!--[if supportFields]><span class=MsoPageNumber><span lang=EN-US style='font-size:14.0pt;font-family:ËÎÌå'><span style='mso-element:field-end'></span></span></span><![endif]-->
+        <span class=MsoPageNumber><span style='font-size:14.0pt;font-family:ËÎÌå'>£­</span></span><span lang=EN-US style='font-size:14.0pt;font-family:ËÎÌå'><o:p></o:p></span>
+    </p>
+</div>
+
+</body>
+
+</html>

+ 29 - 9
o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/standard.html

@@ -1,15 +1,25 @@
 <style>
 <style>
+    @page
+    {mso-page-border-surround-header:no;
+        mso-page-border-surround-footer:no;
+        mso-footnote-separator:url("http://develop.o2oa.net/x_component_process_FormDesigner/Module/Documenteditor/templete/header.htm") fs;
+        mso-footnote-continuation-separator:url("http://develop.o2oa.net/x_component_process_FormDesigner/Module/Documenteditor/templete/header.htm") fcs;
+        mso-endnote-separator:url("http://develop.o2oa.net/x_component_process_FormDesigner/Module/Documenteditor/templete/header.htm") es;
+        mso-endnote-continuation-separator:url("http://develop.o2oa.net/x_component_process_FormDesigner/Module/Documenteditor/templete/header.htm") ecs;
+        mso-facing-pages:yes;}
     @page WordSection1
     @page WordSection1
     {size:595.3pt 841.9pt;
     {size:595.3pt 841.9pt;
         margin:104.9pt 73.7pt 99.25pt 79.4pt;
         margin:104.9pt 73.7pt 99.25pt 79.4pt;
-        mso-header-margin:42.55pt;
-        mso-footer-margin:49.6pt;
-        mso-paper-source:0;
         layout-grid:15.6pt;
         layout-grid:15.6pt;
         line-height:normal;
         line-height:normal;
         font-size:16.0pt;
         font-size:16.0pt;
         font-family:仿宋;
         font-family:仿宋;
         letter-spacing:-0.4pt;
         letter-spacing:-0.4pt;
+        mso-header-margin:42.55pt;
+        mso-footer-margin:70.9pt;
+        mso-even-footer:url("http://develop.o2oa.net/x_component_process_FormDesigner/Module/Documenteditor/templete/header.htm") ef1;
+        mso-footer:url("http://develop.o2oa.net/x_component_process_FormDesigner/Module/Documenteditor/templete/header.htm") f1;
+        mso-paper-source:0;
     }
     }
     div.WordSection1
     div.WordSection1
     {page:WordSection1;
     {page:WordSection1;
@@ -41,7 +51,17 @@
         mso-bidi-font-family:"Times New Roman";
         mso-bidi-font-family:"Times New Roman";
         mso-bidi-theme-font:minor-bidi;
         mso-bidi-theme-font:minor-bidi;
         mso-font-kerning:1.0pt;}
         mso-font-kerning:1.0pt;}
-
+    p.MsoFooter, li.MsoFooter, div.MsoFooter
+    {mso-style-unhide:no;
+        margin:0cm;
+        margin-bottom:.0001pt;
+        mso-pagination:none;
+        tab-stops:center 207.65pt right 415.3pt;
+        layout-grid-mode:char;
+        font-size:9.0pt;
+        font-family:"Times New Roman",serif;
+        mso-fareast-font-family:宋体;
+        mso-font-kerning:1.0pt;}
     .MsoRedHeader
     .MsoRedHeader
     {mso-style-unhide:no;
     {mso-style-unhide:no;
         mso-style-qformat:yes;
         mso-style-qformat:yes;
@@ -150,7 +170,7 @@
 
 
     <div class="doc_block">
     <div class="doc_block">
         <P class=MsoNormal style='font-size:16.0pt;font-family:仿宋;line-height: 22pt'><span>&nbsp</span></P>
         <P class=MsoNormal style='font-size:16.0pt;font-family:仿宋;line-height: 22pt'><span>&nbsp</span></P>
-        <p class=MsoNormal align=center style='text-align:center'><span class="doc_layout_subject" style='font-size:22.0pt; font-weight:bold;font-family:宋体;letter-spacing:normal'>文件标题</span></p>
+        <p class=MsoNormal align=center style='text-align:center'><span class="doc_layout_subject" style='font-size:22.0pt; font-weight:bold;font-family:方正小标,serif;letter-spacing:normal'>文件标题</span></p>
         <P class=MsoNormal style='font-size:12.0pt;font-family:仿宋;line-height: 22pt'><span>&nbsp</span></P>
         <P class=MsoNormal style='font-size:12.0pt;font-family:仿宋;line-height: 22pt'><span>&nbsp</span></P>
     </div>
     </div>
 
 
@@ -250,11 +270,11 @@
 
 
                     <table class=MsoTableGrid border=0 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%;border-collapse:collapse;border:none;'>
                     <table class=MsoTableGrid border=0 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%;border-collapse:collapse;border:none;'>
                         <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;mso-yfti-lastrow:yes;page-break-inside:avoid'>
                         <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;mso-yfti-lastrow:yes;page-break-inside:avoid'>
-                            <td class="doc_layout_edition_issuance" valign=top style='border:none; padding: 0pt 0pt 0pt 14pt'>
-                                <p class=MsoNormal align=left style='text-align:left'><span class="doc_layout_edition_issuance_unit" style='font-size:14.0pt;font-family:仿宋;letter-spacing:-0.4pt'>[印发单位]</span></p>
+                            <td class="doc_layout_edition_issuance" valign=top style='border:none; padding: 0pt 0pt 4pt 14pt'>
+                                <p class=MsoNormal align=left style='line-height:24pt;text-align:left'><span class="doc_layout_edition_issuance_unit" style='font-size:14.0pt;font-family:仿宋;letter-spacing:-0.4pt'>[印发单位]</span></p>
                             </td>
                             </td>
-                            <td valign=top style='border:none; padding: 0pt 14pt 0pt 0pt'>
-                                <p class=MsoNormal align=right style='text-align:right'><span class="doc_layout_edition_issuance_date" style='font-size:14.0pt;font-family:"Times New Roman",仿宋;mso-fareast-font-family:仿宋;mso-ascii-font-family:"Times New Roman"; letter-spacing:0.4pt'>[印发时间]</span></p>
+                            <td valign=top style='border:none; padding: 0pt 14pt 4pt 0pt'>
+                                <p class=MsoNormal align=right style='line-height:24pt;text-align:right'><span class="doc_layout_edition_issuance_date" style='font-size:14.0pt;font-family:"Times New Roman",仿宋;mso-fareast-font-family:仿宋;mso-ascii-font-family:"Times New Roman"; letter-spacing:0.4pt'>[印发时间]</span></p>
                             </td>
                             </td>
                         </tr>
                         </tr>
                     </table>
                     </table>

+ 69 - 0
o2web/source/x_component_process_Xform/Documenteditor.js

@@ -160,6 +160,9 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor =  new Cla
             this.getTempleteJson(function(){
             this.getTempleteJson(function(){
                 var templete = this.json.documentTempleteName || "standard";
                 var templete = this.json.documentTempleteName || "standard";
                 pageContentNode.loadHtml(o2.filterUrl("../x_component_process_FormDesigner/Module/Documenteditor/templete/"+this.templeteJson[templete].file), function(){
                 pageContentNode.loadHtml(o2.filterUrl("../x_component_process_FormDesigner/Module/Documenteditor/templete/"+this.templeteJson[templete].file), function(){
+                    debugger;
+                    this.doPageStyles(pageContentNode);
+
                     if (this.attachmentTemplete){
                     if (this.attachmentTemplete){
                         var attNode = pageContentNode.getElement(".doc_layout_attachment_content");
                         var attNode = pageContentNode.getElement(".doc_layout_attachment_content");
                         if (attNode) attNode.empty();
                         if (attNode) attNode.empty();
@@ -169,7 +172,73 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor =  new Cla
                 }.bind(this));
                 }.bind(this));
             }.bind(this));
             }.bind(this));
         }
         }
+    },
+    doPageStyles: function(pageContentNode){
+        var style = pageContentNode.getLast("style");
+        if (style){
+            var origin = window.location.origin;
+            var header = o2.filterUrl(origin+"/x_component_process_FormDesigner/Module/Documenteditor/templete/header.htm");
+
+            var text = style.get("html");
+            var pageRex = /(?:@page\s*\{)([\s\S]*?)(?:\})/;
+            var arr = text.match(pageRex);
+            if (arr && arr.length){
+                cssText = arr[2];
+                if (cssText){
+                    var last = cssText.substr(cssText.length-1,1);
+                    if (last!==";") cssText = cssText+";";
+                    cssText += "mso-page-border-surround-header:no;\n" +
+                        "        mso-page-border-surround-footer:no;\n" +
+                        "        mso-footnote-separator:url(\""+header+"\") fs;\n" +
+                        "        mso-footnote-continuation-separator:url(\""+header+"\") fcs;\n" +
+                        "        mso-endnote-separator:url(\""+header+"\") es;\n" +
+                        "        mso-endnote-continuation-separator:url(\""+header+"\") ecs;\n" +
+                        "        mso-facing-pages:yes;";
+                    text = text.replace(arr[0], arr[1]+cssText+arr[3]);
+                }
+            }else{
+                text += "@page\n" +
+                    "    {mso-page-border-surround-header:no;\n" +
+                    "        mso-page-border-surround-footer:no;\n" +
+                    "        mso-footnote-separator:url(\""+header+"\") fs;\n" +
+                    "        mso-footnote-continuation-separator:url(\""+header+"\") fcs;\n" +
+                    "        mso-endnote-separator:url(\""+header+"\") es;\n" +
+                    "        mso-endnote-continuation-separator:url(\""+header+"\") ecs;\n" +
+                    "        mso-facing-pages:yes;}"
+            }
 
 
+            pageRex = /(@page\s*WordSection1\s*\{)([\s\S]*?)(\})/;
+            arr = text.match(pageRex);
+            if (arr && arr.length){
+                cssText = arr[2];
+                if (cssText){
+                    var last = cssText.substr(cssText.length-1,1);
+                    if (last!==";") cssText = cssText+";";
+                    cssText += "mso-header-margin:42.55pt;\n" +
+                        "        mso-footer-margin:70.9pt;\n" +
+                        "        mso-even-footer:url(\"http://develop.o2oa.net/x_component_process_FormDesigner/Module/Documenteditor/templete/header.htm\") ef1;\n" +
+                        "        mso-footer:url(\"http://develop.o2oa.net/x_component_process_FormDesigner/Module/Documenteditor/templete/header.htm\") f1;\n" +
+                        "        mso-paper-source:0;";
+                    text = text.replace(arr[0], arr[1]+cssText+arr[3]);
+                }
+            }else{
+                text += "@page WordSection1\n" +
+                    "    {size:595.3pt 841.9pt;\n" +
+                    "        margin:104.9pt 73.7pt 99.25pt 79.4pt;\n" +
+                    "        layout-grid:15.6pt;\n" +
+                    "        line-height:normal;\n" +
+                    "        font-size:16.0pt;\n" +
+                    "        font-family:仿宋;\n" +
+                    "        letter-spacing:-0.4pt;\n" +
+                    "        mso-header-margin:42.55pt;\n" +
+                    "        mso-footer-margin:70.9pt;\n" +
+                    "        mso-even-footer:url(\"http://develop.o2oa.net/x_component_process_FormDesigner/Module/Documenteditor/templete/header.htm\") ef1;\n" +
+                    "        mso-footer:url(\"http://develop.o2oa.net/x_component_process_FormDesigner/Module/Documenteditor/templete/header.htm\") f1;\n" +
+                    "        mso-paper-source:0;\n" +
+                    "    }"
+            }
+            style.set("html", text)
+        }
     },
     },
     getTempleteJson: function(callback){
     getTempleteJson: function(callback){
         if (this.templeteJson){
         if (this.templeteJson){