word导出ftl中常见的标签(Freemarker)

目录

1、调整页边距

2、单元格宽度

3、单元格高度

4、段落间距固定值

5、字体加粗

5、增加表单中的单元格

6、增加表单中的单元格(单元格的右列为空)

7、其它注意事项 


1、调整页边距

<w:sectPr>
    <w:pgSz w:w="16838" w:h="11906" w:orient="landscape"/>
    <w:pgMar w:top="1134" w:right="1134" w:bottom="227" w:left="1701" 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>

 注:上面表示的是上边距为2厘米,下边距为0.4厘米,左边距为3厘米,右边距为2厘米

- `w:top="1134"`:表示页面的上边距为1134缇。

- `w:right="1134"`:表示页面的右边距为1134缇。

- `w:bottom="227"`:表示页面的下边距为227缇。

- `w:left="1701"`:表示页面的左边距为1701缇。

- `w:header="851"`:表示页眉的高度为851缇。

- `w:footer="992"`:表示页脚的高度为992缇。

- `w:gutter="0"`:表示页面的装订线为空,即无装订线。

厘米与缇之间的换算率:1厘米=567缇(取整数,四舍五入)

2、单元格宽度

 <w:tcW w:w="1993" w:type="dxa"/>

注:上面表示该单元格的宽度为1993缇,3.5厘米

3、单元格高度

<w:trPr>
   <w:trHeight w:val="510"/>
</w:trPr>

注:上面表示单元格的高度为510缇,0.9厘米

4、段落间距固定值

<w:p>
   <w:pPr>
       <w:spacing w:line="60" w:line-rule="exact"/>
   </w:pPr>
</w:p>

 注:上图表示段落间距固定值为3磅

磅和缇之间的换算率:1磅=20缇 

如果没有可以直接复制添加 

5、字体加粗

<w:b/>

 注:有<w:b/>标签表示字体是加粗的

5、增加表单中的单元格

<w:tr>
    <w:trPr>
        <w:trHeight w:val="510"/>
    </w:trPr>
    <w:tc>
        <w:tcPr>
            <w:tcW w:w="1962" w:type="dxa"/>
            <w:vmerge/>
            <w:tcBorders>
                <w:left 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:vAlign w:val="center"/>
        </w:tcPr>
        <w:p>
            <w:pPr>
                <w:jc w:val="center"/>
                <w:rPr>
                    <w:rFonts w:ascii="宋体" w:fareast="宋体" w:h-ansi="宋体"/>
                    <wx:font wx:val="宋体"/>
                    <w:b/>
                    <w:sz w:val="24"/>
                    <w:sz-cs w:val="24"/>
                </w:rPr>
            </w:pPr>
        </w:p>
    </w:tc>
    <w:tc>
        <w:tcPr>
            <w:tcW w:w="2002" 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:vAlign w:val="center"/>
        </w:tcPr>
        <w:p>
            <w:pPr>
                <w:jc w:val="center"/>
                <w:rPr>
                    <w:rFonts w:ascii="宋体" w:fareast="宋体" w:h-ansi="宋体"/>
                    <wx:font wx:val="宋体"/>
                    <w:b/>
                    <w:sz w:val="24"/>
                    <w:sz-cs w:val="24"/>
                </w:rPr>
            </w:pPr>
            <w:r>
                <w:rPr>
                    <w:rFonts w:ascii="宋体" w:fareast="宋体" w:h-ansi="宋体" w:hint="fareast"/>
                    <wx:font wx:val="宋体"/>
                    <w:b/>
                    <w:sz w:val="24"/>
                    <w:sz-cs w:val="24"/>
                </w:rPr>
                <w:t>财务负责人</w:t>
            </w:r>
        </w:p>
    </w:tc>
    <w:tc>
        <w:tcPr>
            <w:tcW w:w="3302" 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:vAlign w:val="center"/>
        </w:tcPr>
        <w:p>
            <w:pPr>
                <w:jc w:val="center"/>
                <w:rPr>
                    <w:rFonts w:ascii="宋体" w:fareast="宋体" w:h-ansi="宋体"/>
                    <wx:font wx:val="宋体"/>
                    <w:sz w:val="24"/>
                    <w:sz-cs w:val="24"/>
                </w:rPr>
            </w:pPr>
            <#list cwbmfzrqmList as item>
                <w:r>
                    <w:rPr>
                        <w:rFonts w:ascii="仿宋" w:fareast="仿宋" w:h-ansi="仿宋" w:cs="Arial"
                                  w:hint="fareast"/>
                        <wx:font wx:val="仿宋"/>
                        <w:b/>
                        <w:b-cs/>
                        <w:kern w:val="24"/>
                        <w:sz w:val="28"/>
                        <w:sz-cs w:val="28"/>
                    </w:rPr>
                    <w:pict>
                        <w:binData
                                w:name="${"wordml://0300000"+item_index+".jpg"}">${item}</w:binData>
                        <v:shape id="_x0000_i1026" type="#_x0000_t75"
                                 style="width:68.1pt;height:28.25pt">
                            <v:imagedata src="${"wordml://0300000"+item_index+".jpg"}" o:title="宋"/>
                        </v:shape>
                    </w:pict>
                </w:r>
            </#list>
        </w:p>
    </w:tc>
    <w:tc>
        <w:tcPr>
            <w:tcW w:w="1969" 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:vAlign w:val="center"/>
        </w:tcPr>
        <w:p>
            <w:pPr>
                <w:jc w:val="center"/>
                <w:rPr>
                    <w:rFonts w:ascii="宋体" w:fareast="宋体" w:h-ansi="宋体"/>
                    <wx:font wx:val="宋体"/>
                    <w:b/>
                    <w:sz w:val="24"/>
                    <w:sz-cs w:val="24"/>
                </w:rPr>
            </w:pPr>
            <w:r>
                <w:rPr>
                    <w:rFonts w:ascii="宋体" w:fareast="宋体" w:h-ansi="宋体" w:hint="fareast"/>
                    <wx:font wx:val="宋体"/>
                    <w:b/>
                    <w:sz w:val="24"/>
                    <w:sz-cs w:val="24"/>
                </w:rPr>
                <w:t>部门负责人</w:t>
            </w:r>
        </w:p>
    </w:tc>
    <w:tc>
        <w:tcPr>
            <w:tcW w:w="4232" w:type="dxa"/>
            <w:gridSpan w:val="4"/>
            <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:vAlign w:val="center"/>
        </w:tcPr>
        <w:p>
            <w:pPr>
                <w:jc w:val="center"/>
                <w:rPr>
                    <w:rFonts w:ascii="宋体" w:fareast="宋体" w:h-ansi="宋体"/>
                    <wx:font wx:val="宋体"/>
                    <w:sz w:val="24"/>
                    <w:sz-cs w:val="24"/>
                </w:rPr>
            </w:pPr>
            <#list bmfzrqmList as item>
                <w:r>
                    <w:rPr>
                        <w:rFonts w:ascii="仿宋" w:fareast="仿宋" w:h-ansi="仿宋" w:cs="Arial"
                                  w:hint="fareast"/>
                        <wx:font wx:val="仿宋"/>
                        <w:b/>
                        <w:b-cs/>
                        <w:kern w:val="24"/>
                        <w:sz w:val="28"/>
                        <w:sz-cs w:val="28"/>
                    </w:rPr>
                    <w:pict>
                        <w:binData
                                w:name="${"wordml://0400000"+item_index+".jpg"}">${item}</w:binData>
                        <v:shape id="_x0000_i1026" type="#_x0000_t75"
                                 style="width:68.1pt;height:28.25pt">
                            <v:imagedata src="${"wordml://0400000"+item_index+".jpg"}" o:title="宋"/>
                        </v:shape>
                    </w:pict>
                </w:r>
            </#list>
        </w:p>
    </w:tc>
</w:tr>

注:复制修改即可,需要注意高度宽度和
<w:binData w:name="${"wordml://0200000"+item_index+".jpg"}">${item}</w:binData>属性中的0200000不能重复

<w:gridSpan w:val="1"/>:表示横跨单元格的个数 

6、增加表单中的单元格(单元格的右列为空)

<w:tr>
    <w:trPr>
        <w:trHeight w:val="510"/>
    </w:trPr>
    <w:tc>
        <w:tcPr>
            <w:tcW w:w="0" w:type="auto"/>
            <w:vmerge/>
            <w:tcBorders>
                <w:top w:val="nil"/>
                <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:vAlign w:val="center"/>
        </w:tcPr>
        <w:p>
            <w:pPr>
                <w:widowControl/>
                <w:jc w:val="left"/>
                <w:rPr>
                    <w:rFonts w:ascii="宋体" w:fareast="宋体" w:h-ansi="宋体"/>
                    <wx:font wx:val="宋体"/>
                    <w:b/>
                    <w:sz w:val="24"/>
                    <w:sz-cs w:val="24"/>
                </w:rPr>
            </w:pPr>
        </w:p>
    </w:tc>
    <w:tc>
        <w:tcPr>
            <w:tcW w:w="2002" 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:vAlign w:val="center"/>
        </w:tcPr>
        <w:p>
            <w:pPr>
                <w:jc w:val="center"/>
                <w:rPr>
                    <w:rFonts w:ascii="宋体" w:fareast="宋体" w:h-ansi="宋体"/>
                    <wx:font wx:val="宋体"/>
                    <w:b/>
                    <w:sz w:val="24"/>
                    <w:sz-cs w:val="24"/>
                </w:rPr>
            </w:pPr>
            <w:r>
                <w:rPr>
                    <w:rFonts w:ascii="宋体" w:fareast="宋体" w:h-ansi="宋体" w:hint="fareast"/>
                    <wx:font wx:val="宋体"/>
                    <w:b/>
                    <w:sz w:val="24"/>
                    <w:sz-cs w:val="24"/>
                </w:rPr>
                <w:t>部门负责人</w:t>
            </w:r>
        </w:p>
    </w:tc>
    <w:tc>
        <w:tcPr>
            <w:tcW w:w="3302" 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:vAlign w:val="center"/>
        </w:tcPr>
        <w:p>
            <w:pPr>
                <w:jc w:val="center"/>
                <w:rPr>
                    <w:rFonts w:ascii="宋体" w:fareast="宋体" w:h-ansi="宋体" w:hint="fareast"/>
                    <wx:font wx:val="宋体"/>
                    <w:sz w:val="24"/>
                    <w:sz-cs w:val="24"/>
                </w:rPr>
            </w:pPr>
            <#list bmfzrSet as item>
                <w:r>
                    <w:rPr>
                        <w:rFonts w:ascii="宋体" w:fareast="宋体" w:h-ansi="宋体" w:hint="fareast"/>
                        <wx:font wx:val="宋体"/>
                        <w:sz w:val="24"/>
                        <w:sz-cs w:val="24"/>
                    </w:rPr>
                    <w:pict>
                        <w:binData
                                w:name="${"wordml://02000007"+item_index+".jpg"}">${item}</w:binData>
                        <v:shape id="_x0000_i1031" type="#_x0000_t75"
                                 style="width:68.25pt;height:28.5pt"
                                 o:preferrelative="f">
                            <v:imagedata src="${"wordml://02000007"+item_index+".jpg"}"
                                         o:title="17001-梅泽本1"/>
                            <o:lock v:ext="edit" aspectratio="f"/>
                        </v:shape>
                    </w:pict>
                </w:r>
            </#list>
        </w:p>
    </w:tc>
    <w:tc>
        <w:tcPr>
            <w:tcW w:w="1969" 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:vAlign w:val="center"/>
        </w:tcPr>
        <w:p>
            <w:pPr>
                <w:jc w:val="center"/>
                <w:rPr>
                    <w:rFonts w:ascii="宋体" w:fareast="宋体" w:h-ansi="宋体"/>
                    <wx:font wx:val="宋体"/>
                    <w:b/>
                    <w:sz w:val="24"/>
                    <w:sz-cs w:val="24"/>
                </w:rPr>
            </w:pPr>
        </w:p>
    </w:tc>
    <w:tc>
        <w:tcPr>
            <w:tcW w:w="4227" w:type="dxa"/>
            <w:gridSpan w:val="4"/>
            <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:vAlign w:val="center"/>
        </w:tcPr>
        <w:p>
            <w:pPr>
                <w:jc w:val="center"/>
                <w:rPr>
                    <w:rFonts w:ascii="宋体" w:fareast="宋体" w:h-ansi="宋体"/>
                    <wx:font wx:val="宋体"/>
                    <w:sz w:val="24"/>
                    <w:sz-cs w:val="24"/>
                </w:rPr>
            </w:pPr>
        </w:p>
    </w:tc>
</w:tr>

 如上所示,如果你想添加一个像财务部门负责人一样的单元格,可以复制此段代码

7、其它注意事项  

class 文件位置,可以直接修改此文件,避免频繁重启项目:

E:\IdeaProjects\shuishe\WebContent\WEB-INF\classes\com\landray\kmss\pro\word\template

代码位置: 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值