<%@ page language="java" 
import="java.util.*,com.zhuozhengsoft.pageoffice.*"
 pageEncoding="gb2312"%>

<%
String url=request.getSession().getServletContext().getRealPath("FileMaker/doc/"+"/");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title></title>

    <script type="text/javascript">
        count = 0;
        window.myFunc = function() {
            count++;
            if (count < 10) {
                //子页面刷新：方法一
                //document.frames["iframe1"].window.location.href = document.frames["iframe1"].window.location.href;
                //子页面刷新：方法二（可传参）
                document.frames["iframe1"].window.location.href = "FileMaker.jsp?id=" + count;

                //设置进度条
                document.getElementById("ProgressBarSide").style.visibility = "visible";
                document.getElementById("ProgressBar").style.width = count + "0%";
                //                document.body.insertBefore(document.getElementById("ProgressBarSide"), document.body.childNode[0];
            } else {
                //隐藏进度条div
                document.getElementById("ProgressBarSide").style.visibility = "hidden";
                count = 0;
                //重置进度条
                document.getElementById("ProgressBar").style.width = "0%";
                document.getElementById("aDiv").style.display = "";
                alert('批量转换完毕！');
            }
        };

        //批量转换完毕
        function ConvertFiles() {
            //第一次让子页面自刷新
            document.frames["iframe1"].window.location.href = "FileMaker.jsp?id=" + count;
        }
    </script>

</head>
<body>
    <form id="form1">
    <div id="ProgressBarSide" style="color: Silver; width: 200px; visibility: hidden;
        position: absolute;  left: 40%; top: 50%; margin-top: -32px">
        <span style="color: gray; font-size: 12px; text-align: center;">正在转换请稍后...</span><br />
        <div id="ProgressBar" style="background-color: Green; height: 16px; width: 0%; border-width: 1px;
            border-style: Solid;">
        </div>
    </div>
    <div style="text-align: center;">
        <br />
        <span style="color: Red; font-size: 12px;">演示：把数据填充到模板中批量生成10个正式的word文件，请点下面的按钮进行转换</span><br />
        <input id="Button1" type="button" value="批量转换Word文件" onclick="ConvertFiles()" />
        <div id="aDiv" style="display: none; color: Red; font-size: 12px;">
            <span>转换完成，可在下面的地址中打开文件名为“maker0.doc”到“maker9.doc”的Word文件，查看转换的效果：<%=url %></span>
        </div>
    </div>
    <div style="width: 0px; height: 0px; overflow: hidden;">
        <iframe id="iframe1" name="iframe1" src="" ></iframe>
    </div>
    </form>
</body>
</html>
