1. 程式人生 > >如何在vue專案中使用lodop列印外掛

如何在vue專案中使用lodop列印外掛

https://www.jianshu.com/p/d288963c1a80

 先寫了個webdemo 

<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/12/17
  Time: 13:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>$Title$</title>

    <%--<script type="text/javascript" src="../res/vankewebstyle/js/jquery-1.9.0.js"></script>--%>
    <script language="javascript" src="lodop/LodopFuncs.js"></script>

    <object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>
      <embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0 pluginspage="install_lodop.exe"></embed>
    </object>
    <script type="text/javascript">
        var LODOP; //宣告為全域性變數
        function printPreview(){
            //建立小票列印頁
            CreatePrintPage();
            //列印預覽
            LODOP.PREVIEW();
        }
        function printOrder() {

            //建立小票列印頁
            CreatePrintPage();
            //開始列印
            LODOP.PRINT();

        };
        function CreatePrintPage() {
                var LODOP=getLodop();
                LODOP.PRINT_INIT("test");
                LODOP.SET_PRINT_PAGESIZE (1,'209mm','196mm',2);//設定紙張大小
                LODOP.SET_PRINT_MODE("PRINT_PAGE_PERCENT","Auto-Width");//設定頁面縮放
                LODOP.ADD_PRINT_HTM(25,25,"100%","100%",document.getElementById("textarea01").value);//設定頁面填充內容

                //LODOP.PRINT();

                LODOP.PREVIEW();
        }
    </script>
  <body>
  <embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0 pluginspage="../res/lodop/install_lodop32.exe"></embed>
  <textarea rows="15"  cols="80" style="display: none;" id="textarea01">
<h2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;青島港國際物流有限公司</h2>

<h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;代理費用支出審批單&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</h3>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<strong> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NO.1544670046087</strong></p>

<h3>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;申請日期:2018-03-14</h3>

<table border="1" cellspacing="0" style="width:698.8500pt">
    <tbody>
    <tr>
        <td colspan="2" style="height:24.9500pt; vertical-align:top; width:141.8000pt">
            <p>付款方式:&nbsp;</p>
        </td>
        <td colspan="5" style="height:24.9500pt; vertical-align:top; width:324.0500pt">
            <p>支票&nbsp;[&radic;]&nbsp;網付&nbsp;[ ]&nbsp;現金&nbsp;[ ]&nbsp;其他&nbsp;[ ]&nbsp;</p>
        </td>
        <td colspan="4" style="height:24.9500pt; vertical-align:top; width:233.0000pt">
            <p>申請人:&nbsp;</p>
        </td>
    </tr>
    <tr>
        <td colspan="2" style="height:25.5500pt; vertical-align:top; width:141.8000pt">
            <p>收款單位:&nbsp;</p>
        </td>
        <td colspan="5" style="height:25.5500pt; vertical-align:top; width:324.0500pt">
            <p>青島尚世通報關公司</p>
        </td>
        <td colspan="4" style="height:25.5500pt; vertical-align:top; width:233.0000pt">
            <p>申請部門:礦石&nbsp;</p>
        </td>
    </tr>
    <tr>
        <td colspan="2" style="height:24.9500pt; vertical-align:top; width:141.8000pt">
            <p>開戶行:&nbsp;</p>
        </td>
        <td colspan="5" style="height:24.9500pt; vertical-align:top; width:324.0500pt">
            <p>青島銀行崇明島支行&nbsp;</p>
        </td>
        <td colspan="4" style="height:24.9500pt; vertical-align:top; width:233.0000pt">
            <p>結算稽核:&nbsp;</p>
        </td>
    </tr>
    <tr>
        <td colspan="2" style="height:24.9500pt; vertical-align:top; width:141.8000pt">
            <p>賬號&nbsp;</p>
        </td>
        <td colspan="5" style="height:24.9500pt; vertical-align:top; width:324.0500pt">
            <p>6226661584247</p>
        </td>
        <td colspan="4" style="height:24.9500pt; vertical-align:top; width:233.0000pt">
            <p>&nbsp;</p>
        </td>
    </tr>
    <tr>
        <td style="height:33.4000pt; vertical-align:top; width:84.9500pt">
            <p>客戶名稱&nbsp;</p>
        </td>
        <td style="height:33.4000pt; vertical-align:top; width:56.8500pt">
            <p>貨種&nbsp;</p>
        </td>
        <td style="height:33.4000pt; vertical-align:top; width:56.8000pt">
            <p>船名&nbsp;</p>
        </td>
        <td style="height:33.4000pt; vertical-align:top; width:71.0500pt">
            <p>航次&nbsp;</p>
        </td>
        <td style="height:33.4000pt; vertical-align:top; width:78.1000pt">
            <p>提單號&nbsp;</p>
        </td>
        <td style="height:33.4000pt; vertical-align:top; width:99.4500pt">
            <p>箱型\箱量&nbsp;</p>
        </td>
        <td colspan="2" style="height:33.4000pt; vertical-align:top; width:92.3000pt">
            <p>費用專案&nbsp;</p>
        </td>
        <td style="height:33.4000pt; vertical-align:top; width:81.6500pt">
            <p>付款金額&nbsp;</p>
        </td>
        <td colspan="2" style="height:33.4000pt; vertical-align:top; width:77.7000pt">
            <p>備註&nbsp;</p>
        </td>
    </tr>
    <tr>
        <td style="height:24.9500pt; vertical-align:top; width:84.9500pt">
            <p>&nbsp;</p>
        </td>
        <td style="height:24.9500pt; vertical-align:top; width:56.8500pt">
            <p>&nbsp;</p>
        </td>
        <td style="height:24.9500pt; vertical-align:top; width:56.8000pt">
            <p>&nbsp;</p>
        </td>
        <td style="height:24.9500pt; vertical-align:top; width:71.0500pt">
            <p>&nbsp;</p>
        </td>
        <td style="height:24.9500pt; vertical-align:top; width:78.1000pt">
            <p>附明細&nbsp;</p>
        </td>
        <td style="height:24.9500pt; vertical-align:top; width:99.4500pt">
            <p>&nbsp;</p>
        </td>
        <td colspan="2" style="height:24.9500pt; vertical-align:top; width:92.3000pt">
            <p>單證費&nbsp;</p>
        </td>
        <td style="height:24.9500pt; vertical-align:top; width:81.6500pt">
            <p>50.00</p>
        </td>
        <td colspan="2" style="height:24.9500pt; vertical-align:top; width:77.7000pt">
            <p>&nbsp;</p>
        </td>
    </tr>
    <tr>
        <td style="height:12.7500pt; vertical-align:top; width:84.9500pt">
            <p>合計(¥/$)</p>
        </td>
        <td style="height:12.7500pt; vertical-align:top; width:56.8500pt">
            <p>&nbsp;</p>
        </td>
        <td style="height:12.7500pt; vertical-align:top; width:56.8000pt">
            <p>&nbsp;</p>
        </td>
        <td style="height:12.7500pt; vertical-align:top; width:71.0500pt">
            <p>&nbsp;</p>
        </td>
        <td style="height:12.7500pt; vertical-align:top; width:78.1000pt">
            <p>&nbsp;</p>
        </td>
        <td colspan="3" style="height:12.7500pt; vertical-align:top; width:191.7500pt">
            <p>&nbsp;</p>
        </td>
        <td colspan="2" style="height:12.7500pt; vertical-align:top; width:82.5500pt">
            <p>50.00</p>
        </td>
        <td style="height:12.7500pt; vertical-align:top; width:76.8000pt">
            <p>&nbsp;</p>
        </td>
    </tr>
    <tr>
        <td colspan="2" style="height:24.9500pt; vertical-align:top; width:141.8000pt">
            <p>大寫&nbsp;(&nbsp;人民幣&nbsp;/&nbsp;美金&nbsp;)</p>
        </td>
        <td colspan="9" style="height:24.9500pt; vertical-align:top; width:557.0500pt">
            <p>伍拾元整</p>
        </td>
    </tr>
    </tbody>
</table>

<p>總經理:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;財務部經理:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;部門經理:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>

<p>&nbsp;</p>

<h2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;代理費用支出審批單明細</h2>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<strong> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NO.1544670046087</strong></p>

<p>&nbsp;</p>

<table border="1" cellspacing="0" style="width:429.3500pt">
    <tbody>
    <tr>
        <td style="height:15.4500pt; vertical-align:top; width:45.4500pt">
            <p>客戶名稱&nbsp;</p>
        </td>
        <td style="height:15.4500pt; vertical-align:top; width:42.9000pt">
            <p>貨種&nbsp;</p>
        </td>
        <td style="height:15.4500pt; vertical-align:top; width:42.9000pt">
            <p>船名&nbsp;</p>
        </td>
        <td style="height:15.4500pt; vertical-align:top; width:45.3000pt">
            <p>航次&nbsp;</p>
        </td>
        <td style="height:15.4500pt; vertical-align:top; width:74.7000pt">
            <p>提單號&nbsp;</p>
        </td>
        <td style="height:15.4500pt; vertical-align:top; width:45.7500pt">
            <p>箱型/箱量&nbsp;</p>
        </td>
        <td style="height:15.4500pt; vertical-align:top; width:42.9000pt">
            <p>費用專案&nbsp;</p>
        </td>
        <td style="height:15.4500pt; vertical-align:top; width:46.4000pt">
            <p>付款金額&nbsp;</p>
        </td>
        <td style="height:15.4500pt; vertical-align:top; width:42.9000pt">
            <p>備註&nbsp;</p>
        </td>
    </tr>
    <tr>
        <td style="height:16.2000pt; vertical-align:top; width:45.4500pt">
            <p>青島光輝通達物流倉儲公司&nbsp;</p>
        </td>
        <td style="height:16.2000pt; vertical-align:top; width:42.9000pt">
            <p>錳礦&nbsp;</p>
        </td>
        <td style="height:16.2000pt; vertical-align:top; width:42.9000pt">
            <p>asd&nbsp;</p>
        </td>
        <td style="height:16.2000pt; vertical-align:top; width:45.3000pt">
            <p>123</p>
        </td>
        <td style="height:16.2000pt; vertical-align:top; width:74.7000pt">
            <p>SHSGSSGS</p>
        </td>
        <td style="height:16.2000pt; vertical-align:top; width:45.7500pt">
            <p>&nbsp;</p>
        </td>
        <td style="height:16.2000pt; vertical-align:top; width:42.9000pt">
            <p>報關費&nbsp;</p>
        </td>
        <td style="height:16.2000pt; vertical-align:top; width:46.4000pt">
            <p>¥50.0</p>
        </td>
        <td style="height:16.2000pt; vertical-align:top; width:42.9000pt">
            <p>&nbsp;</p>
        </td>
    </tr>
    <tr>
        <td style="height:15.4500pt; vertical-align:top; width:45.4500pt">
            <p>合計(¥/$)</p>
        </td>
        <td colspan="7" style="height:15.4500pt; vertical-align:top; width:340.8500pt">
            <p>¥50.00</p>
        </td>
        <td style="height:15.4500pt; vertical-align:top; width:42.9000pt">
            <p>&nbsp;</p>
        </td>
    </tr>
    <tr>
        <td colspan="2" style="height:15.4500pt; vertical-align:top; width:88.3500pt">
            <p>大寫(人民幣/美金)</p>
        </td>
        <td colspan="7" style="height:15.4500pt; vertical-align:top; width:340.8500pt">
            <p>伍拾元整</p>
        </td>
    </tr>
    </tbody>
</table>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 申請人:徐洋洋&nbsp;</p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 申請日期:2018-03-14</p>

<p>&nbsp;</p>

</textarea>
  <input type="button" value="列印預覽" onclick="printPreview()" />
  <!-- 控制列印按鈕,自動列印可以直接執行printOrder-->
  <input type="button" value="直接列印" onclick="printOrder()" />

  </body>
</html>

  生成的word的html還未進行頁面調整,而且還有一些變形,預覽效果顯示真的很差...就先這樣吧。