FREEMARKER生成多页多张不确定数量图片WORD文档

2018-01-19  本文已影响740人  785ac245e5c9

需求是:

1.根据查到的记录数生成多页文档

2.在两处位置插入数量不定的图片

最后做出来的实际效果如图:

image

因为固定的模板转换word的文章已经有很多了,我这里主要写下我生成多页不确定数量的图片的
代码

具体思路就是:

1.把模板word文件转换为xml文件(网上有教程)

2.把该模板xml拆分成各部分

i.头

ii.正文

iii.尾

在完成一页记录后,在正文后加入分页符,继续加一页正文,循环直到加完,最后加上尾

3.最终生成的xml文件,经过freemarker渲染后,最终转换成word文件

4.关于插入多张图片

可以把插入图片的xml标签代码循环添加,合并成一段标签,再在正文中想要添加的位置加入这段xml标签


具体代码如下:

做了个工具类,与业务无关,可以直接拷贝使用,注意修改init方法里的模板和word生成地址

(为了方便项目拷代码,我把类,接口全写在一个文件了)

package com.freshpower.timemanage.common.util;

import com.pominfo.framework.exception.PomInfoException;

import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.stereotype.Component;
import sun.misc.BASE64Encoder;

import javax.annotation.PostConstruct;
import java.io.*;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.*;

/**
 * freemarker转分页word
 * Created by zzk on 2018/1/12.
 * <p>
 * 使用方法
 * 1.参考网上教程把模板word文件保存为xml文件
 * 2.在xml文件里把需要替换的参数用${}包装
 * 3.在业务类中调用generateWordWithUncertainPic方法(generateWord方法只能无图片用)
 * 4.实现UncertainPicTemplatePart接口,拆分xml文件各部分(picture部分和separator(换页)部分可以参考以前的)
 * 5.实现PicPlaceholderHolder接口,需要返回图片部分三个属性(base64编码,name,src)的placeholder值
 * 6.实现UncertainPicTemplateFormatter接口
 * i.void replaceWord(Map<String, String> paraMap, T model);
 * paramMap:要替换的键值对放在map里
 * model:传过来的数据
 * ii.PicPlaceholderHolder replacePic(Map<String, Collection<String>> paraMap, T model);
 * paraMap:要替换的键值对放在map里 值为图片的本地路径集合
 * model:传过来的数据
 * 返回PicPlaceholderHolder的实现类
 */

@Component
public class Freemarker2WordUtil {

    private static Configuration configuration;

    private static String templateFileFolderPath;

    private static String wordFileFolderPath;

    @PostConstruct
    private void init() throws IOException {
        configuration = new Configuration();
        configuration.setDefaultEncoding("UTF-8");

        Resource resource = new ClassPathResource("/conf/filePath.properties");
        Properties props = PropertiesLoaderUtils.loadProperties(resource);
        templateFileFolderPath = props.getProperty("uploadFile") + "Template";
        wordFileFolderPath = props.getProperty("uploadFile") + "word";
    }

    //生成word,占位符形式,无图片
    public static <T> String generateWord(List<T> objectList, TemplateFormatter<T> templateFormatter, TemplatePart templatePart) throws IOException, TemplateException, PomInfoException {
        return generate(objectList, templateFormatter, templatePart);
    }

    //生成word,占位符形式,图片数量不确定
    public static <T> String generateWordWithUncertainPic(List<T> objectList, UncertainPicTemplateFormatter<T> templateFormatter, UncertainPicTemplatePart templatePart) throws IOException, TemplateException, PomInfoException {
        return generate(objectList, templateFormatter, templatePart);
    }

    private static <T> String generate(List<T> objectList, TemplateFormatter<T> templateFormatter, TemplatePart templatePart) throws IOException, TemplateException, PomInfoException {

        if (objectList.size() == 0) {
            return null;
        }

        if (templateFormatter == null) {
            throw new PomInfoException("未定义转换规则");
        }

        //辅助类
        FormatSupport formatSupport = new FormatSupport(templatePart);

        //生成模板内容
        String templateContent = handleData(objectList, templateFormatter, formatSupport);

        //生成模板文件
        String templateFile = generateTemplateFile(templateContent);

        //生成word文件
        return generateWordFile(templateFile, formatSupport.getValueMap());

    }

    //1.处理数据
    private static <T> String handleData(List<T> objectList, TemplateFormatter<T> templateFormatter, FormatSupport formatSupport) throws IOException, PomInfoException {

        formatSupport.addHead();

        for (int i = 0; i < objectList.size(); i++) {

            if (i == 0) {
                formatSupport.addContent();
            } else {
                formatSupport.addSeparator().addContent();
            }

            T obj = objectList.get(i);

            Map<String, String> rawParamMap = new HashMap<String, String>();

            templateFormatter.replaceWord(rawParamMap, obj);

            //生成模板内容

            for (Map.Entry<String, String> entry : rawParamMap.entrySet()) {

                formatSupport.replaceKeyAndValue(entry.getKey(), entry.getKey() + "_" + i, entry.getValue());

            }

            //插入图片
            if (templateFormatter instanceof UncertainPicTemplateFormatter) {

                handlePictureData(obj, (UncertainPicTemplateFormatter) templateFormatter, formatSupport, i);

            }
        }

        formatSupport.addFoot();

        return formatSupport.getTemplateContent();
    }

    //处理图片数据
    private static <T> void handlePictureData(T obj, UncertainPicTemplateFormatter templateFormatter, FormatSupport formatSupport, Integer index) throws PomInfoException {

        HashMap<String, LinkedHashSet<String>> rawPicParamMap = new HashMap<String, LinkedHashSet<String>>();

        formatSupport.setPlaceholderHolder(templateFormatter.replacePic(rawPicParamMap, obj));

        for (Map.Entry<String, LinkedHashSet<String>> entry : rawPicParamMap.entrySet()) {

            Iterator<String> iterator = entry.getValue().iterator();

            Integer picIndex = 0;

            while (iterator.hasNext()) {

                String picFile = iterator.next();

                //防止空图片占位置
                if (StringUtils.isEmpty(picFile) || StringUtils.isEmpty(getImageStr(picFile))) {
                    continue;
                }

                //添加图片
                formatSupport.addPic(entry.getKey(), picFile, picIndex, index);

                picIndex++;

            }

            //完成一组图片的添加
            formatSupport.finishAddPicture(entry.getKey());
        }
    }


    //2.生成模板文件
    private static String generateTemplateFile(String content) throws IOException {

        if (!new File(templateFileFolderPath).exists()) {
            new File(templateFileFolderPath).mkdirs();
        }

        if (!new File(wordFileFolderPath).exists()) {
            new File(wordFileFolderPath).mkdirs();
        }

        String templateName = UUID.randomUUID().toString() + ".ftl";

        String localFile = templateFileFolderPath + File.separator + templateName;

        FileOutputStream fos = new FileOutputStream(localFile);

        FileChannel fc = fos.getChannel();

        byte[] bytes = content.getBytes("UTF-8");

        ByteBuffer bb = ByteBuffer.allocate(bytes.length);

        bb.put(bytes);

        bb.flip();

        fc.write(bb);

        return templateName;
    }

    //3.生成word文件
    private static String generateWordFile(String templatePath, Map<String, String> valueMap) throws IOException, TemplateException {

        configuration.setDirectoryForTemplateLoading(new File(templateFileFolderPath));

        Template template = configuration.getTemplate(templatePath, "UTF-8");

        String wordPath = wordFileFolderPath + File.separator + UUID.randomUUID().toString() + ".doc";

        File file = new File(wordPath);

        Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));

        template.process(valueMap, out);

        out.close();

        new File(templatePath).delete();

        return wordPath;

    }

    //图片转base64
    private static String getImageStr(String imgFile) {

        if (!new File(imgFile).exists()) {
            return null;
        }

        InputStream in = null;

        byte[] data = null;

        try {
            in = new FileInputStream(imgFile);
            data = new byte[in.available()];
            in.read(data);
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

        BASE64Encoder encoder = new BASE64Encoder();

        return encoder.encode(data);
    }


    //接口定义

    //辅助类
    private static class FormatSupport {

        //模板内容
        private String templateContent;

        //要传给freemarker替换的键值对
        private HashMap<String, String> valueMap;

        //templatePart对象
        private TemplatePart templatePart;

        //临时内容
        private String tempContent;

        //保存图片部分各占位符的引用工具类
        private PicPlaceholderHolder placeholderHolder;

        public FormatSupport(TemplatePart template) {

            templatePart = template;

            valueMap = new HashMap<String, String>();

            templateContent = "";

            tempContent = "";
        }

        public FormatSupport addHead() {
            templateContent = templateContent + templatePart.getHead();
            return this;
        }

        public FormatSupport addContent() {
            templateContent = templateContent + templatePart.getContent();
            return this;
        }

        public FormatSupport addSeparator() {
            templateContent = templateContent + templatePart.getSeparator();
            return this;
        }

        public FormatSupport addFoot() {
            templateContent = templateContent + templatePart.getFoot();
            return this;
        }


        public void validateKeyExist(String key) throws PomInfoException {
            if (templateContent.indexOf("${" + key + "}") == -1) {
                throw new PomInfoException("未找到替换key,key:" + key);
            }
        }


        //完成添加图片
        public void finishAddPicture(String pictureKey) throws PomInfoException {

            validateKeyExist(pictureKey);

            templateContent = templateContent.replace("{" + pictureKey + "}", tempContent);
            tempContent = "";
        }

        //添加图片
        public FormatSupport addPic(String pictureKey, String picturePath, Integer innerIndex, Integer outerIndex) throws PomInfoException {

            if (templatePart instanceof UncertainPicTemplatePart) {
                tempContent = tempContent + ((UncertainPicTemplatePart) templatePart).getPicture();
            } else {
                throw new PomInfoException("接口类型错误");
            }

            if (placeholderHolder == null || StringUtils.isEmpty(placeholderHolder.getPicPlaceholder()) || StringUtils.isEmpty(placeholderHolder.getVImagedataSrcPlaceholder()) || StringUtils.isEmpty(placeholderHolder.getWNamePlaceholder())) {
                throw new PomInfoException("PlaceholderHolder接口有误");
            }


            //加入图片
            String picPlaceholder = placeholderHolder.getPicPlaceholder();

            String wNamePlaceholder = placeholderHolder.getWNamePlaceholder();

            String vImagedataSrcPlaceholder = placeholderHolder.getVImagedataSrcPlaceholder();

            String replaceKey = pictureKey + "_" + innerIndex + "_" + outerIndex;

            if (StringUtils.isEmpty(picPlaceholder) || StringUtils.isEmpty(replaceKey)) {
                return this;
            }

            if (tempContent.indexOf("${" + picPlaceholder + "}") == -1) {
                throw new PomInfoException("未找到替换key,key:" + picPlaceholder);
            }

            String base64 = getImageStr(picturePath);

            tempContent = tempContent.replace("{" + picPlaceholder + "}", "{" + replaceKey + "}");
            valueMap.put(replaceKey, base64);

            //更改wname

            replaceKey = "wordml://" + replaceKey + ".jpg";


            if (StringUtils.isEmpty(wNamePlaceholder) || StringUtils.isEmpty(replaceKey)) {
                return this;
            }

            if (tempContent.indexOf("${" + wNamePlaceholder + "}") == -1) {
                throw new PomInfoException("未找到替换key,key:" + wNamePlaceholder);
            }

            tempContent = tempContent.replace("${" + wNamePlaceholder + "}",  replaceKey);

            //更改src

            if (StringUtils.isEmpty(vImagedataSrcPlaceholder) || StringUtils.isEmpty(replaceKey)) {
                return this;
            }

            if (tempContent.indexOf("${" + vImagedataSrcPlaceholder + "}") == -1) {
                throw new PomInfoException("未找到替换key,key:" + vImagedataSrcPlaceholder);
            }

            tempContent = tempContent.replace("${" + vImagedataSrcPlaceholder + "}", replaceKey);

            return this;
        }

        public FormatSupport replaceKeyAndValue(String originalKey, String replaceKey, String value) throws PomInfoException {
            if (StringUtils.isEmpty(originalKey) || StringUtils.isEmpty(replaceKey)) {
                return this;
            }
            if (StringUtils.isEmpty(value)) {
                value = "";
            }

            validateKeyExist(originalKey);

            templateContent = templateContent.replace("{" + originalKey + "}", "{" + replaceKey + "}");
            valueMap.put(replaceKey, value);
            return this;

        }


        public void setPlaceholderHolder(PicPlaceholderHolder placeholderHolder) {
            this.placeholderHolder = placeholderHolder;
        }

        public String getTemplateContent() {
            return templateContent;
        }

        public HashMap<String, String> getValueMap() {
            return valueMap;
        }
    }


    //通用转换
    public interface TemplateFormatter<T> {

        /**
         * @param paraMap map key 被替换字段 value 要替换的字段
         *                model 数据模型
         * @description
         * @method replaceWord
         * @reurn void
         * @date 2018/1/18 8:58
         * @author zhouzhanke
         */
        void replaceWord(Map<String, String> paraMap, T model);

    }

    //多张不确定图片模板转换
    public interface UncertainPicTemplateFormatter<T> extends TemplateFormatter<T> {

        /**
         * @param paraMap map key 被替换字段 value list传图片本地地址
         *                model 数据模型
         * @description
         * @method
         * @reurn 图片key
         * @date 2018/1/18 8:58
         * @author zhouzhanke
         */
        PicPlaceholderHolder replacePic(Map<String, Collection<String>> paraMap, T model);

    }


    public interface PicPlaceholderHolder {

        //获得pic替换的字符串
        String getPicPlaceholder();

        String getWNamePlaceholder();

        String getVImagedataSrcPlaceholder();

    }


    public interface TemplatePart {

        String getFoot();

        String getHead();

        String getContent();

        String getSeparator();

    }

    public interface UncertainPicTemplatePart extends TemplatePart {

        String getPicture();

    }

}

附上我的模板拆分的xml样式

package com.freshpower.timemanage.pm.model;

import com.freshpower.timemanage.common.util.Freemarker2WordUtil;

/**
 * Created by zzk on 2018/1/11.
 */
public class ReplaceWorkTemplatePart implements Freemarker2WordUtil.UncertainPicTemplatePart {

    private final String head = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
            "<?mso-application progid=\"Word.Document\"?>\n" +
            "<w:wordDocument xmlns:aml=\"http://schemas.microsoft.com/aml/2001/core\" xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:dt=\"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.microsoft.com/office/word/2003/wordml\" xmlns:wx=\"http://schemas.microsoft.com/office/word/2003/auxHint\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wsp=\"http://schemas.microsoft.com/office/word/2003/wordml/sp2\" xmlns:sl=\"http://schemas.microsoft.com/schemaLibrary/2003/core\" w:macrosPresent=\"no\" w:embeddedObjPresent=\"no\" w:ocxPresent=\"no\" xml:space=\"preserve\"><w:ignoreSubtree w:val=\"http://schemas.microsoft.com/office/word/2003/wordml/sp2\"/><o:DocumentProperties><o:Author>admin</o:Author><o:LastAuthor>admin</o:LastAuthor><o:Revision>6</o:Revision><o:TotalTime>4</o:TotalTime><o:Created>2018-01-11T07:50:00Z</o:Created><o:LastSaved>2018-01-11T07:54:00Z</o:LastSaved><o:Pages>1</o:Pages><o:Words>13</o:Words><o:Characters>75</o:Characters><o:Lines>1</o:Lines><o:Paragraphs>1</o:Paragraphs><o:CharactersWithSpaces>87</o:CharactersWithSpaces><o:Version>14</o:Version></o:DocumentProperties><w:fonts><w:defaultFonts w:ascii=\"Calibri\" w:fareast=\"宋体\" w:h-ansi=\"Calibri\" w:cs=\"Times New Roman\"/><w:font w:name=\"Times New Roman\"><w:panose-1 w:val=\"02020603050405020304\"/><w:charset w:val=\"00\"/><w:family w:val=\"Roman\"/><w:pitch w:val=\"variable\"/><w:sig w:usb-0=\"E0002AFF\" w:usb-1=\"C0007841\" w:usb-2=\"00000009\" w:usb-3=\"00000000\" w:csb-0=\"000001FF\" w:csb-1=\"00000000\"/></w:font><w:font w:name=\"Arial\"><w:panose-1 w:val=\"020B0604020202020204\"/><w:charset w:val=\"00\"/><w:family w:val=\"Swiss\"/><w:pitch w:val=\"variable\"/><w:sig w:usb-0=\"E0002AFF\" w:usb-1=\"C0007843\" w:usb-2=\"00000009\" w:usb-3=\"00000000\" w:csb-0=\"000001FF\" w:csb-1=\"00000000\"/></w:font><w:font w:name=\"宋体\"><w:altName w:val=\"SimSun\"/><w:panose-1 w:val=\"02010600030101010101\"/><w:charset w:val=\"86\"/><w:family w:val=\"auto\"/><w:pitch w:val=\"variable\"/><w:sig w:usb-0=\"00000003\" w:usb-1=\"288F0000\" w:usb-2=\"00000016\" w:usb-3=\"00000000\" w:csb-0=\"00040001\" w:csb-1=\"00000000\"/></w:font><w:font w:name=\"宋体\"><w:altName w:val=\"SimSun\"/><w:panose-1 w:val=\"02010600030101010101\"/><w:charset w:val=\"86\"/><w:family w:val=\"auto\"/><w:pitch w:val=\"variable\"/><w:sig w:usb-0=\"00000003\" w:usb-1=\"288F0000\" w:usb-2=\"00000016\" w:usb-3=\"00000000\" w:csb-0=\"00040001\" w:csb-1=\"00000000\"/></w:font><w:font w:name=\"Calibri\"><w:panose-1 w:val=\"020F0502020204030204\"/><w:charset w:val=\"00\"/><w:family w:val=\"Swiss\"/><w:pitch w:val=\"variable\"/><w:sig w:usb-0=\"E00002FF\" w:usb-1=\"4000ACFF\" w:usb-2=\"00000001\" w:usb-3=\"00000000\" w:csb-0=\"0000019F\" w:csb-1=\"00000000\"/></w:font><w:font w:name=\"@宋体\"><w:panose-1 w:val=\"02010600030101010101\"/><w:charset w:val=\"86\"/><w:family w:val=\"auto\"/><w:pitch w:val=\"variable\"/><w:sig w:usb-0=\"00000003\" w:usb-1=\"288F0000\" w:usb-2=\"00000016\" w:usb-3=\"00000000\" w:csb-0=\"00040001\" w:csb-1=\"00000000\"/></w:font></w:fonts><w:styles><w:versionOfBuiltInStylenames w:val=\"7\"/><w:latentStyles w:defLockedState=\"off\" w:latentStyleCount=\"267\"><w:lsdException w:name=\"Normal\"/><w:lsdException w:name=\"heading 1\"/><w:lsdException w:name=\"heading 2\"/><w:lsdException w:name=\"heading 3\"/><w:lsdException w:name=\"heading 4\"/><w:lsdException w:name=\"heading 5\"/><w:lsdException w:name=\"heading 6\"/><w:lsdException w:name=\"heading 7\"/><w:lsdException w:name=\"heading 8\"/><w:lsdException w:name=\"heading 9\"/><w:lsdException w:name=\"toc 1\"/><w:lsdException w:name=\"toc 2\"/><w:lsdException w:name=\"toc 3\"/><w:lsdException w:name=\"toc 4\"/><w:lsdException w:name=\"toc 5\"/><w:lsdException w:name=\"toc 6\"/><w:lsdException w:name=\"toc 7\"/><w:lsdException w:name=\"toc 8\"/><w:lsdException w:name=\"toc 9\"/><w:lsdException w:name=\"caption\"/><w:lsdException w:name=\"Title\"/><w:lsdException w:name=\"Default Paragraph Font\"/><w:lsdException w:name=\"Subtitle\"/><w:lsdException w:name=\"Strong\"/><w:lsdException w:name=\"Emphasis\"/><w:lsdException w:name=\"Table Grid\"/><w:lsdException w:name=\"Placeholder Text\"/><w:lsdException w:name=\"No Spacing\"/><w:lsdException w:name=\"Light Shading\"/><w:lsdException w:name=\"Light List\"/><w:lsdException w:name=\"Light Grid\"/><w:lsdException w:name=\"Medium Shading 1\"/><w:lsdException w:name=\"Medium Shading 2\"/><w:lsdException w:name=\"Medium List 1\"/><w:lsdException w:name=\"Medium List 2\"/><w:lsdException w:name=\"Medium Grid 1\"/><w:lsdException w:name=\"Medium Grid 2\"/><w:lsdException w:name=\"Medium Grid 3\"/><w:lsdException w:name=\"Dark List\"/><w:lsdException w:name=\"Colorful Shading\"/><w:lsdException w:name=\"Colorful List\"/><w:lsdException w:name=\"Colorful Grid\"/><w:lsdException w:name=\"Light Shading Accent 1\"/><w:lsdException w:name=\"Light List Accent 1\"/><w:lsdException w:name=\"Light Grid Accent 1\"/><w:lsdException w:name=\"Medium Shading 1 Accent 1\"/><w:lsdException w:name=\"Medium Shading 2 Accent 1\"/><w:lsdException w:name=\"Medium List 1 Accent 1\"/><w:lsdException w:name=\"Revision\"/><w:lsdException w:name=\"List Paragraph\"/><w:lsdException w:name=\"Quote\"/><w:lsdException w:name=\"Intense Quote\"/><w:lsdException w:name=\"Medium List 2 Accent 1\"/><w:lsdException w:name=\"Medium Grid 1 Accent 1\"/><w:lsdException w:name=\"Medium Grid 2 Accent 1\"/><w:lsdException w:name=\"Medium Grid 3 Accent 1\"/><w:lsdException w:name=\"Dark List Accent 1\"/><w:lsdException w:name=\"Colorful Shading Accent 1\"/><w:lsdException w:name=\"Colorful List Accent 1\"/><w:lsdException w:name=\"Colorful Grid Accent 1\"/><w:lsdException w:name=\"Light Shading Accent 2\"/><w:lsdException w:name=\"Light List Accent 2\"/><w:lsdException w:name=\"Light Grid Accent 2\"/><w:lsdException w:name=\"Medium Shading 1 Accent 2\"/><w:lsdException w:name=\"Medium Shading 2 Accent 2\"/><w:lsdException w:name=\"Medium List 1 Accent 2\"/><w:lsdException w:name=\"Medium List 2 Accent 2\"/><w:lsdException w:name=\"Medium Grid 1 Accent 2\"/><w:lsdException w:name=\"Medium Grid 2 Accent 2\"/><w:lsdException w:name=\"Medium Grid 3 Accent 2\"/><w:lsdException w:name=\"Dark List Accent 2\"/><w:lsdException w:name=\"Colorful Shading Accent 2\"/><w:lsdException w:name=\"Colorful List Accent 2\"/><w:lsdException w:name=\"Colorful Grid Accent 2\"/><w:lsdException w:name=\"Light Shading Accent 3\"/><w:lsdException w:name=\"Light List Accent 3\"/><w:lsdException w:name=\"Light Grid Accent 3\"/><w:lsdException w:name=\"Medium Shading 1 Accent 3\"/><w:lsdException w:name=\"Medium Shading 2 Accent 3\"/><w:lsdException w:name=\"Medium List 1 Accent 3\"/><w:lsdException w:name=\"Medium List 2 Accent 3\"/><w:lsdException w:name=\"Medium Grid 1 Accent 3\"/><w:lsdException w:name=\"Medium Grid 2 Accent 3\"/><w:lsdException w:name=\"Medium Grid 3 Accent 3\"/><w:lsdException w:name=\"Dark List Accent 3\"/><w:lsdException w:name=\"Colorful Shading Accent 3\"/><w:lsdException w:name=\"Colorful List Accent 3\"/><w:lsdException w:name=\"Colorful Grid Accent 3\"/><w:lsdException w:name=\"Light Shading Accent 4\"/><w:lsdException w:name=\"Light List Accent 4\"/><w:lsdException w:name=\"Light Grid Accent 4\"/><w:lsdException w:name=\"Medium Shading 1 Accent 4\"/><w:lsdException w:name=\"Medium Shading 2 Accent 4\"/><w:lsdException w:name=\"Medium List 1 Accent 4\"/><w:lsdException w:name=\"Medium List 2 Accent 4\"/><w:lsdException w:name=\"Medium Grid 1 Accent 4\"/><w:lsdException w:name=\"Medium Grid 2 Accent 4\"/><w:lsdException w:name=\"Medium Grid 3 Accent 4\"/><w:lsdException w:name=\"Dark List Accent 4\"/><w:lsdException w:name=\"Colorful Shading Accent 4\"/><w:lsdException w:name=\"Colorful List Accent 4\"/><w:lsdException w:name=\"Colorful Grid Accent 4\"/><w:lsdException w:name=\"Light Shading Accent 5\"/><w:lsdException w:name=\"Light List Accent 5\"/><w:lsdException w:name=\"Light Grid Accent 5\"/><w:lsdException w:name=\"Medium Shading 1 Accent 5\"/><w:lsdException w:name=\"Medium Shading 2 Accent 5\"/><w:lsdException w:name=\"Medium List 1 Accent 5\"/><w:lsdException w:name=\"Medium List 2 Accent 5\"/><w:lsdException w:name=\"Medium Grid 1 Accent 5\"/><w:lsdException w:name=\"Medium Grid 2 Accent 5\"/><w:lsdException w:name=\"Medium Grid 3 Accent 5\"/><w:lsdException w:name=\"Dark List Accent 5\"/><w:lsdException w:name=\"Colorful Shading Accent 5\"/><w:lsdException w:name=\"Colorful List Accent 5\"/><w:lsdException w:name=\"Colorful Grid Accent 5\"/><w:lsdException w:name=\"Light Shading Accent 6\"/><w:lsdException w:name=\"Light List Accent 6\"/><w:lsdException w:name=\"Light Grid Accent 6\"/><w:lsdException w:name=\"Medium Shading 1 Accent 6\"/><w:lsdException w:name=\"Medium Shading 2 Accent 6\"/><w:lsdException w:name=\"Medium List 1 Accent 6\"/><w:lsdException w:name=\"Medium List 2 Accent 6\"/><w:lsdException w:name=\"Medium Grid 1 Accent 6\"/><w:lsdException w:name=\"Medium Grid 2 Accent 6\"/><w:lsdException w:name=\"Medium Grid 3 Accent 6\"/><w:lsdException w:name=\"Dark List Accent 6\"/><w:lsdException w:name=\"Colorful Shading Accent 6\"/><w:lsdException w:name=\"Colorful List Accent 6\"/><w:lsdException w:name=\"Colorful Grid Accent 6\"/><w:lsdException w:name=\"Subtle Emphasis\"/><w:lsdException w:name=\"Intense Emphasis\"/><w:lsdException w:name=\"Subtle Reference\"/><w:lsdException w:name=\"Intense Reference\"/><w:lsdException w:name=\"Book Title\"/><w:lsdException w:name=\"Bibliography\"/><w:lsdException w:name=\"TOC Heading\"/></w:latentStyles><w:style w:type=\"paragraph\" w:default=\"on\" w:styleId=\"a\"><w:name w:val=\"Normal\"/><wx:uiName wx:val=\"正文\"/><w:rsid w:val=\"009256B8\"/><w:pPr><w:widowControl w:val=\"off\"/><w:jc w:val=\"both\"/></w:pPr><w:rPr><w:rFonts w:cs=\"Arial\"/><wx:font wx:val=\"Calibri\"/><w:kern w:val=\"2\"/><w:sz w:val=\"21\"/><w:sz-cs w:val=\"22\"/><w:lang w:val=\"EN-US\" w:fareast=\"ZH-CN\" w:bidi=\"AR-SA\"/></w:rPr></w:style><w:style w:type=\"character\" w:default=\"on\" w:styleId=\"a0\"><w:name w:val=\"Default Paragraph Font\"/><wx:uiName wx:val=\"默认段落字体\"/></w:style><w:style w:type=\"table\" w:default=\"on\" w:styleId=\"a1\"><w:name w:val=\"Normal Table\"/><wx:uiName wx:val=\"普通表格\"/><w:rPr><wx:font wx:val=\"Calibri\"/><w:lang w:val=\"EN-US\" w:fareast=\"ZH-CN\" w:bidi=\"AR-SA\"/></w:rPr><w:tblPr><w:tblInd w:w=\"0\" w:type=\"dxa\"/><w:tblCellMar><w:top w:w=\"0\" w:type=\"dxa\"/><w:left w:w=\"108\" w:type=\"dxa\"/><w:bottom w:w=\"0\" w:type=\"dxa\"/><w:right w:w=\"108\" w:type=\"dxa\"/></w:tblCellMar></w:tblPr></w:style><w:style w:type=\"list\" w:default=\"on\" w:styleId=\"a2\"><w:name w:val=\"No List\"/><wx:uiName wx:val=\"无列表\"/></w:style><w:style w:type=\"paragraph\" w:styleId=\"a3\"><w:name w:val=\"Balloon Text\"/><wx:uiName wx:val=\"批注框文本\"/><w:basedOn w:val=\"a\"/><w:link w:val=\"Char\"/><w:rsid w:val=\"009256B8\"/><w:rPr><wx:font wx:val=\"Calibri\"/><w:sz w:val=\"18\"/><w:sz-cs w:val=\"18\"/></w:rPr></w:style><w:style w:type=\"character\" w:styleId=\"Char\"><w:name w:val=\"批注框文本 Char\"/><w:link w:val=\"a3\"/><w:rsid w:val=\"009256B8\"/><w:rPr><w:rFonts w:ascii=\"Calibri\" w:fareast=\"宋体\" w:h-ansi=\"Calibri\" w:cs=\"Arial\"/><w:sz w:val=\"18\"/><w:sz-cs w:val=\"18\"/></w:rPr></w:style></w:styles><w:divs><w:div w:id=\"129178495\"><w:bodyDiv w:val=\"on\"/><w:marLeft w:val=\"0\"/><w:marRight w:val=\"0\"/><w:marTop w:val=\"0\"/><w:marBottom w:val=\"0\"/><w:divBdr><w:top w:val=\"none\" w:sz=\"0\" wx:bdrwidth=\"0\" w:space=\"0\" w:color=\"auto\"/><w:left w:val=\"none\" w:sz=\"0\" wx:bdrwidth=\"0\" w:space=\"0\" w:color=\"auto\"/><w:bottom w:val=\"none\" w:sz=\"0\" wx:bdrwidth=\"0\" w:space=\"0\" w:color=\"auto\"/><w:right w:val=\"none\" w:sz=\"0\" wx:bdrwidth=\"0\" w:space=\"0\" w:color=\"auto\"/></w:divBdr></w:div></w:divs><w:shapeDefaults><o:shapedefaults v:ext=\"edit\" spidmax=\"1026\"/><o:shapelayout v:ext=\"edit\"><o:idmap v:ext=\"edit\" data=\"1\"/></o:shapelayout></w:shapeDefaults><w:docPr><w:view w:val=\"print\"/><w:zoom w:percent=\"110\"/><w:doNotEmbedSystemFonts/><w:bordersDontSurroundHeader/><w:bordersDontSurroundFooter/><w:defaultTabStop w:val=\"420\"/><w:drawingGridVerticalSpacing w:val=\"156\"/><w:displayHorizontalDrawingGridEvery w:val=\"0\"/><w:displayVerticalDrawingGridEvery w:val=\"2\"/><w:punctuationKerning/><w:characterSpacingControl w:val=\"CompressPunctuation\"/><w:optimizeForBrowser/><w:allowPNG/><w:validateAgainstSchema/><w:saveInvalidXML w:val=\"off\"/><w:ignoreMixedContent w:val=\"off\"/><w:alwaysShowPlaceholderText w:val=\"off\"/><w:compat><w:spaceForUL/><w:balanceSingleByteDoubleByteWidth/><w:doNotLeaveBackslashAlone/><w:ulTrailSpace/><w:doNotExpandShiftReturn/><w:adjustLineHeightInTable/><w:breakWrappedTables/><w:snapToGridInCell/><w:wrapTextWithPunct/><w:useAsianBreakRules/><w:dontGrowAutofit/><w:useFELayout/></w:compat><wsp:rsids><wsp:rsidRoot wsp:val=\"009256B8\"/><wsp:rsid wsp:val=\"00341CDD\"/><wsp:rsid wsp:val=\"003E550E\"/><wsp:rsid wsp:val=\"0077408F\"/><wsp:rsid wsp:val=\"009256B8\"/><wsp:rsid wsp:val=\"00B418A8\"/><wsp:rsid wsp:val=\"00BD43E8\"/><wsp:rsid wsp:val=\"00BF6250\"/></wsp:rsids></w:docPr><w:body>\n";


    private final String content = "<wx:sect><w:tbl><w:tblPr><w:tblW w:w=\"0\" w:type=\"auto\"/><w:tblInd w:w=\"141\" w:type=\"dxa\"/><w:tblBorders><w:top w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:left w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:bottom w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:right w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/></w:tblBorders><w:tblCellMar><w:left w:w=\"0\" w:type=\"dxa\"/><w:right w:w=\"0\" w:type=\"dxa\"/></w:tblCellMar><w:tblLook w:val=\"04A0\"/></w:tblPr><w:tblGrid><w:gridCol w:w=\"705\"/><w:gridCol w:w=\"992\"/><w:gridCol w:w=\"6458\"/></w:tblGrid><w:tr wsp:rsidR=\"009256B8\" wsp:rsidTr=\"009256B8\"><w:trPr><w:trHeight w:val=\"82\"/></w:trPr><w:tc><w:tcPr><w:tcW w:w=\"8155\" w:type=\"dxa\"/><w:gridSpan w:val=\"3\"/><w:tcBorders><w:top w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:left w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:bottom w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:right w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/></w:tcBorders></w:tcPr><w:p wsp:rsidR=\"009256B8\" wsp:rsidRDefault=\"009256B8\"><w:pPr><w:autoSpaceDN w:val=\"off\"/><w:spacing w:line=\"360\" w:line-rule=\"auto\"/><w:ind w:first-line-chars=\"1150\" w:first-line=\"2424\"/><w:outlineLvl w:val=\"1\"/><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\"/><wx:font wx:val=\"Arial\"/><w:b/><w:b-cs/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:hint=\"fareast\"/><wx:font wx:val=\"宋体\"/><w:b/><w:b-cs/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr><w:t>值班记录</w:t></w:r><w:r><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\"/><wx:font wx:val=\"Arial\"/><w:b/><w:b-cs/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr><w:t>        </w:t></w:r><w:proofErr w:type=\"gramStart\"/><w:r><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:hint=\"fareast\"/><wx:font wx:val=\"宋体\"/><w:b/><w:b-cs/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr><w:t>${date}</w:t></w:r><w:proofErr w:type=\"gramEnd\"/><w:r><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\"/><wx:font wx:val=\"Arial\"/><w:b/><w:b-cs/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr><w:t>    </w:t></w:r><w:r><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:hint=\"fareast\"/><wx:font wx:val=\"宋体\"/><w:b/><w:b-cs/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr><w:t>${order}</w:t></w:r></w:p></w:tc></w:tr><w:tr wsp:rsidR=\"00C35C61\" wsp:rsidTr=\"00C35C61\"><w:trPr><w:trHeight w:val=\"2684\"/></w:trPr><w:tc><w:tcPr><w:tcW w:w=\"705\" w:type=\"dxa\"/><w:tcBorders><w:top w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:left w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:bottom w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:right w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/></w:tcBorders></w:tcPr><w:p wsp:rsidR=\"00C35C61\" wsp:rsidRDefault=\"00C35C61\"><w:pPr><w:autoSpaceDN w:val=\"off\"/><w:spacing w:line=\"360\" w:line-rule=\"auto\"/><w:ind w:left=\"113\" w:right=\"113\"/><w:jc w:val=\"center\"/><w:outlineLvl w:val=\"1\"/><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:hint=\"fareast\"/><wx:font wx:val=\"Arial\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr></w:pPr></w:p><w:p wsp:rsidR=\"00C35C61\" wsp:rsidRDefault=\"00201B50\"><w:pPr><w:autoSpaceDN w:val=\"off\"/><w:spacing w:line=\"360\" w:line-rule=\"auto\"/><w:ind w:left=\"113\" w:right=\"113\"/><w:jc w:val=\"center\"/><w:outlineLvl w:val=\"1\"/><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\"/><wx:font wx:val=\"Arial\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:hint=\"fareast\"/><wx:font wx:val=\"宋体\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr><w:t>交班</w:t></w:r><w:r wsp:rsidR=\"00C35C61\"><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:hint=\"fareast\"/><wx:font wx:val=\"宋体\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr><w:t>记录</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"7450\" w:type=\"dxa\"/><w:gridSpan w:val=\"2\"/><w:tcBorders><w:top w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:left w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:bottom w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:right w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/></w:tcBorders></w:tcPr><w:p wsp:rsidR=\"00C35C61\" wsp:rsidRDefault=\"00C35C61\"><w:pPr><w:autoSpaceDN w:val=\"off\"/><w:spacing w:line=\"360\" w:line-rule=\"auto\"/><w:outlineLvl w:val=\"1\"/><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\"/><wx:font wx:val=\"Arial\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\" w:hint=\"fareast\"/><wx:font wx:val=\"宋体\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr><w:t>${jbjl}</w:t></w:r></w:p></w:tc></w:tr><w:tr wsp:rsidR=\"00C35C61\" wsp:rsidTr=\"00C35C61\"><w:trPr><w:trHeight w:val=\"2684\"/></w:trPr><w:tc><w:tcPr><w:tcW w:w=\"705\" w:type=\"dxa\"/><w:tcBorders><w:top w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:left w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:bottom w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:right w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/></w:tcBorders></w:tcPr><w:p wsp:rsidR=\"00C35C61\" wsp:rsidRDefault=\"00C35C61\"><w:pPr><w:autoSpaceDN w:val=\"off\"/><w:spacing w:line=\"360\" w:line-rule=\"auto\"/><w:ind w:left=\"113\" w:right=\"113\"/><w:jc w:val=\"center\"/><w:outlineLvl w:val=\"1\"/><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\"/><wx:font wx:val=\"Arial\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr></w:pPr></w:p><w:p wsp:rsidR=\"00C35C61\" wsp:rsidRDefault=\"00C35C61\"><w:pPr><w:autoSpaceDN w:val=\"off\"/><w:spacing w:line=\"360\" w:line-rule=\"auto\"/><w:ind w:left=\"113\" w:right=\"113\"/><w:jc w:val=\"center\"/><w:outlineLvl w:val=\"1\"/><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\"/><wx:font wx:val=\"Arial\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:hint=\"fareast\"/><wx:font wx:val=\"宋体\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr><w:t>本班记录</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"7450\" w:type=\"dxa\"/><w:gridSpan w:val=\"2\"/><w:tcBorders><w:top w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:left w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:bottom w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:right w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/></w:tcBorders></w:tcPr><w:p wsp:rsidR=\"009256B8\" wsp:rsidRDefault=\"00341CDD\" wsp:rsidP=\"00341CDD\"><w:pPr><w:autoSpaceDN w:val=\"off\"/><w:spacing w:line=\"360\" w:line-rule=\"auto\"/><w:outlineLvl w:val=\"1\"/><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\"/><wx:font wx:val=\"Arial\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:hint=\"fareast\"/><wx:font wx:val=\"宋体\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr><w:t>${bbjl}</w:t></w:r></w:p></w:tc></w:tr><w:tr wsp:rsidR=\"009256B8\" wsp:rsidTr=\"009256B8\"><w:trPr><w:trHeight w:val=\"2833\"/></w:trPr><w:tc><w:tcPr><w:tcW w:w=\"705\" w:type=\"dxa\"/><w:tcBorders><w:top w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:left w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:bottom w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:right w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/></w:tcBorders></w:tcPr><w:p wsp:rsidR=\"009256B8\" wsp:rsidRDefault=\"009256B8\"><w:pPr><w:autoSpaceDN w:val=\"off\"/><w:spacing w:line=\"360\" w:line-rule=\"auto\"/><w:ind w:left=\"113\" w:right=\"113\"/><w:jc w:val=\"center\"/><w:outlineLvl w:val=\"1\"/><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\"/><wx:font wx:val=\"Arial\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr></w:pPr></w:p><w:p wsp:rsidR=\"009256B8\" wsp:rsidRDefault=\"009256B8\"><w:pPr><w:autoSpaceDN w:val=\"off\"/><w:spacing w:line=\"360\" w:line-rule=\"auto\"/><w:ind w:left=\"113\" w:right=\"113\"/><w:jc w:val=\"center\"/><w:outlineLvl w:val=\"1\"/><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\"/><wx:font wx:val=\"Arial\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:hint=\"fareast\"/><wx:font wx:val=\"宋体\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr><w:t>缺陷记录</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"7450\" w:type=\"dxa\"/><w:gridSpan w:val=\"2\"/><w:tcBorders><w:top w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:left w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:bottom w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:right w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/></w:tcBorders></w:tcPr><w:p wsp:rsidR=\"009256B8\" wsp:rsidRDefault=\"00BF6250\" wsp:rsidP=\"00BD43E8\"><w:pPr><w:autoSpaceDN w:val=\"off\"/><w:spacing w:line=\"360\" w:line-rule=\"auto\"/><w:outlineLvl w:val=\"1\"/><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\"/><wx:font wx:val=\"Arial\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:hint=\"fareast\"/><wx:font wx:val=\"宋体\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr><w:t>${qxjl}</w:t></w:r></w:p></w:tc></w:tr><w:tr wsp:rsidR=\"009256B8\" wsp:rsidTr=\"009256B8\"><w:tc><w:tcPr><w:tcW w:w=\"1697\" w:type=\"dxa\"/><w:gridSpan w:val=\"2\"/><w:tcBorders><w:top w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:left w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:bottom w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:right w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/></w:tcBorders></w:tcPr><w:p wsp:rsidR=\"009256B8\" wsp:rsidRDefault=\"009256B8\"><w:pPr><w:autoSpaceDN w:val=\"off\"/><w:spacing w:line=\"360\" w:line-rule=\"auto\"/><w:outlineLvl w:val=\"1\"/><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\"/><wx:font wx:val=\"Arial\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:hint=\"fareast\"/><wx:font wx:val=\"宋体\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr><w:t>交班人签字:</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"6458\" w:type=\"dxa\"/><w:tcBorders><w:top w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:left w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:bottom w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:right w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/></w:tcBorders></w:tcPr><w:p wsp:rsidR=\"009256B8\" wsp:rsidRDefault=\"009256B8\"><w:pPr><w:autoSpaceDN w:val=\"off\"/><w:spacing w:line=\"360\" w:line-rule=\"auto\"/><w:outlineLvl w:val=\"1\"/><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\"/><wx:font wx:val=\"Arial\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr></w:pPr><w:r wsp:rsidRPr=\"00E1293C\"><w:rPr><w:noProof/></w:rPr>" + "${图片占位符1}" + "</w:r></w:p></w:tc></w:tr><w:tr wsp:rsidR=\"009256B8\" wsp:rsidTr=\"009256B8\"><w:tc><w:tcPr><w:tcW w:w=\"1697\" w:type=\"dxa\"/><w:gridSpan w:val=\"2\"/><w:tcBorders><w:top w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:left w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:bottom w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:right w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/></w:tcBorders></w:tcPr><w:p wsp:rsidR=\"009256B8\" wsp:rsidRDefault=\"009256B8\"><w:pPr><w:autoSpaceDN w:val=\"off\"/><w:spacing w:line=\"360\" w:line-rule=\"auto\"/><w:outlineLvl w:val=\"1\"/><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\"/><wx:font wx:val=\"Arial\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"宋体\" w:hint=\"fareast\"/><wx:font wx:val=\"宋体\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr><w:t>接班人签字:</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"6458\" w:type=\"dxa\"/><w:tcBorders><w:top w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:left w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:bottom w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/><w:right w:val=\"single\" w:sz=\"4\" wx:bdrwidth=\"10\" w:space=\"0\" w:color=\"auto\"/></w:tcBorders></w:tcPr><w:p wsp:rsidR=\"009256B8\" wsp:rsidRDefault=\"009256B8\"><w:pPr><w:autoSpaceDN w:val=\"off\"/><w:spacing w:line=\"360\" w:line-rule=\"auto\"/><w:outlineLvl w:val=\"1\"/><w:rPr><w:rFonts w:ascii=\"Arial\" w:h-ansi=\"Arial\"/><wx:font wx:val=\"Arial\"/><w:color w:val=\"333333\"/><w:sz-cs w:val=\"21\"/></w:rPr></w:pPr><w:r wsp:rsidRPr=\"00E1293C\"><w:rPr><w:noProof/></w:rPr>" + "${图片占位符2}" + "</w:r></w:p></w:tc></w:tr></w:tbl><w:p wsp:rsidR=\"009256B8\" wsp:rsidRDefault=\"009256B8\" wsp:rsidP=\"009256B8\"><w:pPr><w:autoSpaceDN w:val=\"off\"/><w:rPr><w:sz-cs w:val=\"21\"/></w:rPr></w:pPr></w:p><w:p wsp:rsidR=\"00B418A8\" wsp:rsidRDefault=\"00B418A8\"/><w:sectPr wsp:rsidR=\"00B418A8\"><w:pgSz w:w=\"11906\" w:h=\"16838\"/><w:pgMar w:top=\"1440\" w:right=\"1800\" w:bottom=\"1440\" w:left=\"1800\" w:header=\"851\" w:footer=\"992\" w:gutter=\"0\"/><w:cols w:space=\"425\"/><w:docGrid w:type=\"lines\" w:line-pitch=\"312\"/></w:sectPr></wx:sect>";


    private final String separator = "<w:p wsp:rsidR=\"00DC00A2\" wsp:rsidRDefault=\"00DC00A2\" wsp:rsidP=\"00850F6B\"><w:pPr><w:sectPr wsp:rsidR=\"00DC00A2\" wsp:rsidSect=\"00C76F8B\"></w:sectPr></w:pPr><w:r wsp:rsidRPr=\"001C1E32\"><w:rPr></w:rPr></w:r></w:p>\n";


    private final String foot = "</w:body></w:wordDocument>";


    private final String picture = "<w:pict><v:shapetype id=\"_x0000_t75\" coordsize=\"21600,21600\" o:spt=\"75\" o:preferrelative=\"t\" path=\"m@4@5l@4@11@9@11@9@5xe\" filled=\"f\" stroked=\"f\"><v:stroke joinstyle=\"miter\"/><v:formulas><v:f eqn=\"if lineDrawn pixelLineWidth 0\"/><v:f eqn=\"sum @0 1 0\"/><v:f eqn=\"sum 0 0 @1\"/><v:f eqn=\"prod @2 1 2\"/><v:f eqn=\"prod @3 21600 pixelWidth\"/><v:f eqn=\"prod @3 21600 pixelHeight\"/><v:f eqn=\"sum @0 0 1\"/><v:f eqn=\"prod @6 1 2\"/><v:f eqn=\"prod @7 21600 pixelWidth\"/><v:f eqn=\"sum @8 21600 0\"/><v:f eqn=\"prod @7 21600 pixelHeight\"/><v:f eqn=\"sum @10 21600 0\"/></v:formulas><v:path o:extrusionok=\"f\" gradientshapeok=\"t\" o:connecttype=\"rect\"/><o:lock v:ext=\"edit\" aspectratio=\"t\"/></v:shapetype><w:binData w:name=\"${wName}\" xml:space=\"preserve\">${picture}\n" +
            "</w:binData><v:shape id=\"图片 1\" o:spid=\"_x0000_i1025\" type=\"#_x0000_t75\" style=\"width:1in;height:76pt;visibility:visible;mso-wrap-style:square\"><v:imagedata src=\"${src}\" o:title=\"\"/></v:shape></w:pict>";

    @Override
    public String getFoot() {
        return foot;
    }

    @Override
    public String getHead() {
        return head;
    }

    @Override
    public String getContent() {
        return content;
    }

    @Override
    public String getSeparator() {
        return separator;
    }

    @Override
    public String getPicture() {
        return picture;
    }

}

业务类里的使用

        ArrayList<ReplaceWork> processedList = new ArrayList<ReplaceWork>(processedMap.values());

        String wordPath = Freemarker2WordUtil.generateWordWithUncertainPic(processedList, new Freemarker2WordUtil.UncertainPicTemplateFormatter<ReplaceWork>() {
            @Override
            public Freemarker2WordUtil.PicPlaceholderHolder replacePic(Map<String, Collection<String>> paraMap, ReplaceWork model) {
                paraMap.put("图片占位符1", model.getSendSignFile());
                paraMap.put("图片占位符2", model.getGetSignFile());
                return new Freemarker2WordUtil.PicPlaceholderHolder() {
                    @Override
                    public String getPicPlaceholder() {
                        return "picture";
                    }

                    @Override
                    public String getWNamePlaceholder() {
                        return "wName";
                    }

                    @Override
                    public String getVImagedataSrcPlaceholder() {
                        return "src";
                    }
                };
            }

            @Override
            public void replaceWord(Map<String, String> paraMap, ReplaceWork model) {
                paraMap.put("order", workTypeMap.get(model.getWorkType()));
                paraMap.put("date", formatter.format(model.getStartDateTime()));
                paraMap.put("jbjl", model.getSendDataTxt());
                paraMap.put("bbjl", model.getOwnDataTxt());
                paraMap.put("qxjl", model.getBugDataTxt());
            }
        },new ReplaceWorkTemplatePart());

上一篇 下一篇

猜你喜欢

热点阅读