java html导出添加空行和空格

news2024/11/29 11:59:06

情景:

    要求导出签批单: 格式如下,

要获取“主办处室负责人”和“相关处室会签”环节的处理意见、处理人员和处理日期进行替换,导出word文档。

处理:

        主要是如何拼接内容?

      方法一

               导出word,直接拼内容,然后导出。 这样比较麻烦,而且格式控制是一个大问题(主要也不是很熟悉,处理起来就比较麻烦)

       方法二:

                把内容写到纯html里面,然后直接导出html。这样要修改样式也比较方便。

写html:
 

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <meta http-equiv="Content-Style-Type" content="text/css"/> 
        <title></title>
    </head>
    <body>
        <div style="text-align:center;">
            <p style="margin:0pt; orphans:0; text-align:center; widows:0">
                <span style="font-family:宋体; font-size:22pt">签批单</span>
            </p>
            <table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt;margin:0 auto;">
                <tr style="height:31.85pt">
                    <td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:105.6pt">
                        <p style="margin:0pt; orphans:0; text-align:center; widows:0">
                            <span style="font-family:宋体; font-size:14pt">经办人</span>
                        </p>
                    </td>
                    <td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:80.2pt">
                        <p style="margin:0pt; orphans:0; text-align:justify; widows:0">
                            <span style="font-family:宋体; font-size:14pt">&#xa0;</span>
                        </p>
                    </td>
                    <td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:46.75pt">
                        <p style="margin:0pt; orphans:0; text-align:center; widows:0">
                            <span style="font-family:宋体; font-size:14pt">日期</span>
                        </p>
                    </td>
                    <td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:139.05pt">
                        <p style="margin:0pt; orphans:0; text-align:center; widows:0">
                            <span style="font-family:宋体; font-size:14pt"></span>
                            <span style="font-family:宋体; font-size:14pt">年  </span>
                            <span style="font-family:宋体; font-size:14pt"></span>
                            <span style="font-family:宋体; font-size:14pt">月  </span>
                            <span style="font-family:宋体; font-size:14pt"></span>
                            <span style="font-family:宋体; font-size:14pt">日</span>
                        </p>
                    </td>
                </tr>
                <tr style="height:228.6pt">
                    <td colspan="4" style="position:relative; border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:404pt">
                        <p style="margin:0pt; orphans:0; text-align:justify; widows:0;position: absolute;top:40px;">
                            <span style="font-family:宋体; font-size:14pt">签批事由:</span>
                        </p>
                        <p style="margin:0pt; orphans:0; text-align:right; widows:0;">  
                        </p>
                        <p style="margin:0pt; orphans:0; text-align:right; widows:0;position: absolute;bottom:40px;right: 10px;">
                            <span style="font-family:宋体; font-size:14pt;padding-right: 50px;">用</span>
                            <span style="font-family:宋体; font-size:14pt;padding-right: 30px;">印章</span> 
                        </p>
                    </td>
                </tr>
                <tr style="height:102.85pt">
                    <td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:105.6pt">
                        <p style="margin:0pt; orphans:0; text-align:center; widows:0">
                            <span style="font-family:宋体; font-size:14pt">主办处室负责人</span>
                        </p>
                    </td>
                    <td colspan="3" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:287.6pt">
                        <p style="margin:0pt; orphans:0; text-align:justify; widows:0">
                            <span style="font-family:宋体; font-size:14pt">处理意见</span>
                        </p>
                        <p style="margin:0pt; orphans:0; text-align:center; widows:0">
                            <span style="font-family:宋体; font-size:14pt">&#xa0;</span>
                        </p>
                        <p style="margin:0pt; orphans:0; text-align:right; widows:0;padding-right: 10px;">
                            <span style="font-family:宋体; font-size:14pt">处理人员 处理日期</span>
                        </p>
                    </td>
                </tr>
                <tr style="height:96.25pt">
                    <td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:105.6pt">
                        <p style="margin:0pt; orphans:0; text-align:center; widows:0;">
                            <span style="font-family:宋体; font-size:14pt">相关处室会签</span>
                        </p>
                    </td>
                    <td colspan="3" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:287.6pt">
                        <p style="margin:0pt; orphans:0; text-align:justify; widows:0">
                            <span style="font-family:宋体; font-size:14pt">处理意见</span>
                        </p>
                        <p style="margin:0pt; orphans:0; text-align:center; widows:0">
                            <span style="font-family:宋体; font-size:14pt">&#xa0;</span>
                        </p>
                        <p style="margin:0pt; orphans:0; text-align:right; widows:0;padding-right: 10px;">
                            <span style="font-family:宋体; font-size:14pt">处理人员 处理日期</span>
                        </p>
                    </td>
                </tr>
                <tr style="height:45.65pt">
                    <td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:105.6pt">
                        <p style="margin:0pt; orphans:0; text-align:center; widows:0">
                            <span style="font-family:宋体; font-size:14pt">批准人</span>
                        </p>
                    </td>
                    <td colspan="3" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:287.6pt">
                        <p style="margin:0pt; orphans:0; text-align:center; widows:0">
                            <span style="font-family:宋体; font-size:14pt">&#xa0;</span>
                        </p>
                    </td>
                </tr>
                <tr style="height:0pt">
                    <td style="width:116.4pt; border:none"></td>
                    <td style="width:91pt; border:none"></td>
                    <td style="width:57.55pt; border:none"></td>
                    <td style="width:149.85pt; border:none"></td>
                </tr>
            </table>
        </div> 
    </body>
</html>

打开html的效果是想要的;

导出html

  《导出html到word》,这边做一个优化,添加response的处理

    public static void exportDoc(String html, String fileName, HttpServletResponse response) throws IOException {
        setFileName(fileName, response);
        exportDoc(html, response.getOutputStream());
    }

    public static void setFileName(String fileName,HttpServletResponse response) {
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/plain");

        try {
            fileName = URLEncoder.encode(fileName, "UTF-8");
            response.setCharacterEncoding("UTF-8");
            response.addHeader("Content-Disposition", "attachment; filename=" + fileName);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

调用:

// controller
    @ResponseBody
    @RequestMapping(value = "/exportSignSheet", method = RequestMethod.GET)
    @ApiOperation("导出签批单")
    public void exportSignSheet(@RequestParam("condition") String condition,HttpServletResponse response) throws IOException {
        signService.exportSignSheet(condition, response);
    }

  
// service
  public void exportSignSheet(String condition, HttpServletResponse response) throws IOException {
     
        String html = SignApprove.getSignApproveHtml(); // 把内容放到实体里面
        
       //  html = html.replace  内容替换
        String fileName = "签批单-"+changeDateToStr(new Date())+".doc";
        HtmlToWordUtils.exportDoc(html, fileName, response);
    }

    private String changeDateToStr(Date date){ 
        String dateStr = DateUtils.formatDate(date);
        String[] split = dateStr.split("-");
        return split[0]+"年"+split[1]+"月"+split[2]+"日";
    }

结果:

中间的内容缩起来了。 试了下中间的文档加最小高度:右下角的添加空白:

<p style="margin:0pt; orphans:0; text-align:justify; widows:0;position: absolute;top:40px;">
	<span style="font-family:宋体; font-size:14pt">签批事由:</span>
</p>
<p style="margin:0pt; orphans:0; text-align:right; widows:0; min-height:150px;">  
</p>
<p style="margin:0pt; orphans:0; text-align:right; widows:0;position: absolute;bottom:40px;right: 10px;">
	<span style="font-family:宋体; font-size:14pt;padding-right: 50px;">用</span>
	<span style="font-family:宋体; font-size:14pt;padding-right: 50px;">印章</span> 
</p>

 结果并不起作用。应该是java到导出的时候,空白的地方会缩进,这时候写css样式是不起作用的。

添加空行和占位符:

中间要加空行(因为中间不用填写内容),直接加多行:

<p style="margin:0pt; orphans:0; text-align:center; widows:0">
	<span style="font-family:宋体; font-size:14pt">&#xa0;</span>
</p>

空格使用占位符: &#xa0;

<p style="margin:0pt; orphans:0; text-align:right; widows:0;position: absolute;bottom:40px;right: 10px;">
	<span style="font-family:宋体; font-size:14pt;padding-right: 50px;">用&#xa0;&#xa0;</span>
	<span style="font-family:宋体; font-size:14pt;">印章&#xa0;</span> 
</p>

最后使用的html:

public class SignApprove {

    public static String getSignApproveHtml() {
        return "<html>\n" +
                "    <head>\n" +
                "        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n" +
                "        <meta http-equiv=\"Content-Style-Type\" content=\"text/css\"/> \n" +
                "        <title></title>\n" +
                "    </head>\n" +
                "    <body>\n" +
                "        <div style=\"text-align:center;\">\n" +
                "            <p style=\"margin:0pt; orphans:0; text-align:center; widows:0\">\n" +
                "                <span style=\"font-family:宋体; font-size:22pt\">签批单</span>\n" +
                "            </p>\n" +
                "            <table cellspacing=\"0\" cellpadding=\"0\" style=\"border-collapse:collapse; margin-left:0pt;margin:0 auto;\">\n" +
                "                <tr style=\"height:31.85pt\">\n" +
                "                    <td style=\"border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:105.6pt\">\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:center; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">经办人</span>\n" +
                "                        </p>\n" +
                "                    </td>\n" +
                "                    <td style=\"border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:80.2pt\">\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:justify; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">&#xa0;</span>\n" +
                "                        </p>\n" +
                "                    </td>\n" +
                "                    <td style=\"border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:46.75pt\">\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:center; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">日期</span>\n" +
                "                        </p>\n" +
                "                    </td>\n" +
                "                    <td style=\"border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:139.05pt\">\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:center; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\"></span>\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">年  </span>\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\"></span>\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">月  </span>\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\"></span>\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">日</span>\n" +
                "                        </p>\n" +
                "                    </td>\n" +
                "                </tr>\n" +
                "                <tr style=\"height:228.6pt\">\n" +
                "                    <td colspan=\"4\" style=\"position:relative; border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:404pt\">\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:justify; widows:0;position: absolute;top:40px;\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">签批事由:</span>\n" +
                "                        </p>\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:right; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">&#xa0;</span>\n" +
                "                        </p>\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:right; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">&#xa0;</span>\n" +
                "                        </p>\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:right; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">&#xa0;</span>\n" +
                "                        </p>\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:right; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">&#xa0;</span>\n" +
                "                        </p>\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:right; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">&#xa0;</span>\n" +
                "                        </p>\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:right; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">&#xa0;</span>\n" +
                "                        </p>\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:right; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">&#xa0;</span>\n" +
                "                        </p>\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:right; widows:0;position: absolute;bottom:40px;right: 10px;\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt;padding-right: 80px;\">用&#xa0;&#xa0;</span>\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt;\">印章</span>\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt;\">&#xa0;</span>\n" +
                "                        </p>\n" +
                "                    </td>\n" +
                "                </tr>\n" +
                "                <tr style=\"height:102.85pt\">\n" +
                "                    <td style=\"border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:105.6pt\">\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:center; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">主办处室负责人</span>\n" +
                "                        </p>\n" +
                "                    </td>\n" +
                "                    <td colspan=\"3\" style=\"border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:287.6pt\">\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:justify; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">处理意见  </span>\n" +
                "                        </p>\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:center; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">&#xa0;</span>\n" +
                "                        </p>\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:right; widows:0;padding-right: 10px;\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">处理人员 处理日期</span>\n" +
                "                        </p>\n" +
                "                    </td>\n" +
                "                </tr>\n" +
                "                <tr style=\"height:96.25pt\">\n" +
                "                    <td style=\"border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:105.6pt\">\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:center; widows:0;\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">相关处室会签</span>\n" +
                "                        </p>\n" +
                "                    </td>\n" +
                "                    <td colspan=\"3\" style=\"border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:287.6pt\">\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:justify; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">处理意见  </span>\n" +
                "                        </p>\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:center; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">&#xa0;</span>\n" +
                "                        </p>\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:right; widows:0;padding-right: 10px;\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">处理人员 处理日期</span>\n" +
                "                        </p>\n" +
                "                    </td>\n" +
                "                </tr>\n" +
                "                <tr style=\"height:45.65pt\">\n" +
                "                    <td style=\"border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:105.6pt\">\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:center; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">批准人</span>\n" +
                "                        </p>\n" +
                "                    </td>\n" +
                "                    <td colspan=\"3\" style=\"border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:287.6pt\">\n" +
                "                        <p style=\"margin:0pt; orphans:0; text-align:center; widows:0\">\n" +
                "                            <span style=\"font-family:宋体; font-size:14pt\">&#xa0;</span>\n" +
                "                        </p>\n" +
                "                    </td>\n" +
                "                </tr>\n" +
                "                <tr style=\"height:0pt\">\n" +
                "                    <td style=\"width:116.4pt; border:none\"></td>\n" +
                "                    <td style=\"width:91pt; border:none\"></td>\n" +
                "                    <td style=\"width:57.55pt; border:none\"></td>\n" +
                "                    <td style=\"width:149.85pt; border:none\"></td>\n" +
                "                </tr>\n" +
                "            </table>\n" +
                "        </div> \n" +
                "    </body>\n" +
                "</html>\n";
    }
}

再进行导出,就符合要求了。



总结:

        导出word文档,可以考虑使用导出html的方式,尤其是复杂的,没多少规律的。如果是有多行空白的,就使用多行<p></p>的方式;对于多个空格的使用空格站位符。 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/626290.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

爬虫如何发送 HTTP 请求

爬虫可以使用 Python 中的 requests 库来发送 HTTP 请求。requests 库提供了简单易用的 API&#xff0c;可以方便地发送 GET、POST 等请求&#xff0c;并且支持设置请求头、请求参数、代理等功能。 以下是一个使用 requests 库发送 GET 请求的示例代码&#xff1a; import re…

国产触控笔哪个牌子好?第三方电容笔推荐

对于那些把iPad当做学习工具的人来说&#xff0c;这已经成为了他们生活中不可缺少的一部分。但没有人买得起苹果原装电容笔&#xff0c;因为苹果电容笔的售价太贵了。因此&#xff0c;最好还是用一支普通的电容笔。我是个一个苹果粉&#xff0c;同时也是个数字发烧友&#xff0…

十年之约 记账表格(会员专享)

* * * 原创&#xff1a;刘教链 * * * 6号&#xff0c;教链发起了十年之约加密投资实证计划。 很多读者、会员纷纷同行。 有朋友问及教链所用记账表格。可根据文章中的介绍自制。为方便会员&#xff0c;教链已将该表格上传至刘教链的加密投资星球&#xff0c;供下载。 另外&…

喜报 | 小米智能语音通讯技术获“深圳人工智能行业应用奖”

日前&#xff0c;2022年度第二届“深圳人工智能奖”正式揭晓。 “小米智能语音技术在手机实时通信中的应用”项目&#xff0c;凭借丰硕的创新成果、广泛的应用场景&#xff0c;获得“深圳人工智能行业应用奖”&#xff01; “深圳人工智能行业应用奖”旨在表彰人工智能行业应用…

springcloud使用nacos搭建注册中心

nacos安装这里就不细说了&#xff0c;(Nacos下载以及搭建环境_你非柠檬为何心酸142的博客-CSDN博客) 大家也可以去网上安装好&#xff0c;这里主要讲搭建 &#xff0c;我们需要手动启动nacos, 输入(.\startup.cmd -m standalone),出现一下图标就代表ok 首先是父工程所需要的依…

Java009——Java数据类型变量的简单认识

一、Java数据类型 围绕以下3点学习&#xff1a; 1、什么是Java数据类型&#xff1f; 2、Java数据类型的作用&#xff1f; 3、Java有哪些数据类型&#xff1f; 4、熟悉Java8大基本数据类型 1.1、什么是Java数据类型&#xff1f; 当我们写Java代码时&#xff0c;需要把数据保存…

react设计模式,jsx

1.修改配置项&#xff1a; eject&#xff1a;暴露配置项&#xff01;&#xff01;&#xff01;一旦暴露了就无法还原回去 会报错。这个错误:我们刚才把代码改了&#xff0c;在暴露之前&#xff0c;先让我们把代码提交到git历史区保留下来—防止暴露后的代码覆盖了我们该的代码 …

02_MySQL的索引结构

1. BTree索引 B-Tree即B树&#xff0c;Balance Tree&#xff0c;平衡树,它的高度远小于平衡二叉树的高度。2-3树是最简单的B树结构。B树的阶&#xff1a;节点的最多子节点个数。比如2-3树的阶是3&#xff0c;2-3-4树的阶是4。 1.1 初始化介绍 一颗b树&#xff0c;浅蓝色的块我们…

什么是AI业务流程质检,如何用它做好销售和服务过程监督

近几年&#xff0c;随着语音转写、语义理解和机器学习等技术的成熟&#xff0c;越来越多的企业开始部署基于AI技术的智能质检系统&#xff0c;来帮助坐席、销售和服务团队提高沟通质量管理能力&#xff0c;同时提升沟通中的客户体验。 不过&#xff0c;不论是最初的人工质检&a…

【Word技巧】打印部分内容或者隐藏不打印的内容,如何操作?

在工作中&#xff0c;我们经常需要打印各种Word文档&#xff0c;但有时候&#xff0c;我们只需要打印文档的其中一部分内容&#xff0c;或者有部分内容并不想打印出来&#xff0c;要如何操作呢&#xff1f; 还不了解的小伙伴&#xff0c;可以看看下面的方法哦。 一、设置打印其…

node.js+vue药品药店进销存管理系统jb526

开发语言 node.js 框架&#xff1a;Express 前端:Vue.js 数据库&#xff1a;mysql 数据库工具&#xff1a;Navicat 开发软件&#xff1a;VScode 重点研究的&#xff0c;关键的问题&#xff1a; &#xff08;1&#xff09;业务流程&#xff1b; &#xff08;2&#xff09;前台…

广发证券传媒互联网首席分析师旷实:大模型引发的创新浪潮不会很快结束丨数据猿专访...

‍数据智能产业创新服务媒体 ——聚焦数智 改变商业 AI大模型引爆了今年一季度的热点。 今年春节期间&#xff0c;来自微软投资的OpenAI旗下产品ChatGPT成为科技行业关注焦点&#xff0c;出现即推热了市场情绪。随后&#xff0c;国内百度首发文心一言&#xff0c;阿里、华为、…

DevExpress WPF功能区控件,更轻松创建应用工具栏!(上)

DevExpress WPF的Ribbon、Toolbar和Menus组件以Microsoft Office为灵感&#xff0c;针对WPF开发人员进行了优化&#xff0c;可帮助您在段时间内模拟当今最流行的商业生产力应用程序。 DevExpress WPF拥有120个控件和库&#xff0c;将帮助您交付满足甚至超出企业需求的高性能业…

深度学习应用篇-计算机视觉-语义分割综述[6]:DeepLab系列简介、DeepLabV3深入解读创新点、训练策略、主要贡献

【深度学习入门到进阶】必看系列&#xff0c;含激活函数、优化策略、损失函数、模型调优、归一化算法、卷积模型、序列模型、预训练模型、对抗神经网络等 专栏详细介绍&#xff1a;【深度学习入门到进阶】必看系列&#xff0c;含激活函数、优化策略、损失函数、模型调优、归一化…

MATLAB 之 数值积分和离散傅里叶变换

这里写目录标题 一、数值积分1. 数值积分基本原理2. 数值积分的实现2.1 变步长辛普森法2.2 自适应积分法2.3 高斯——克朗罗德法2.4 梯形积分法2.5 累计梯形积分 3. 多重定积分的数值求解 二、离散傅里叶变换1. 离散傅里叶变换算法简介2. 离散傅里叶变换的实现 一、数值积分 数…

通信算法之167: (低空无人机)机载通信物理层基带算法设计

一.物理层基带仿真 通信系统的链路级仿真主要可以分成5个部分。 1.系统参数 2.发送机算法 3.信道模型 4.接收机算法 5.统计性能 其中主要组成部分很明显是中间三部分&#xff0c;即发送&#xff0c;信道&#xff0c;接收。但系统参数和统计性能这两部分的适当设计会大大…

在webpack中使用Eslint

一、Eslint介绍 要在webpack中使用Eslint首先我们先了解下什么是Eslint 1. 什么是Eslint ESLint是一个用于在JavaScript代码中发现和报告问题的静态代码分析工具。它可以检测常见的编码错误&#xff0c;如拼写错误、变量未声明、使用未定义的变量等&#xff0c;还可以检测代…

1.3C++运算符重载规则

C运算符重载规则 重载的运算符必须是C中已有的运算符。 重载运算符的参数个数必须与原来的运算符相同。 重载运算符的优先级和结合性与原来的运算符相同。 重载运算符必须是类的成员函数或全局函数。 重载运算符不能改变原有的语义。 不能改变运算符的操作数类型&#xf…

sqoop系列:sqoop(离线数据同步)采集节点安装

目录 1&#xff1a;安装包准备 2&#xff1a;添加环境变量 3&#xff1a;配置部署 3.1) 修改sqoop-env.sh 3.2) 验证安装是否成功 3.3) 测试Sqoop是否能够成功连接数据库 报错&#xff1a;Exception in thread "main" java.lang.NoClassDefFoundError: org/apa…

【023】C/C++数据结构之链表及其实战应用

C 链表及其实战应用 引言一、链表的概述二、利用链表设计一个学生管理系统2.1、设计主函数main()2.2、实现插入节点2.3、实现链表的遍历2.4、实现链表的查找2.5、实现删除某个节点2.6、实现释放链表2.7、完整代码 总结 引言 &#x1f4a1; 作者简介&#xff1a;专注于C/C高性能…