模板格式:
当前实现:
java中使用freeMarker根据word模板导出word文档,当前实现是遍历的list,请高手指教如何合并相同单元格,实现模板的格式!
freeMarker中可以实现合并单元格么?还是改变数据的结构?
“.ftl”模板:
<#list pojo as pojo2>
<w:tr wsp:rsidR="00B6699A" wsp:rsidRPr="002C3EBD" wsp:rsidTr="002C3EBD">
<w:trPr>
<w:trHeight w:val="2318"/>
</w:trPr>
<w:tc>
<w:tcPr>
<w:tcW w:w="534" w:type="dxa"/>
<w:tcBorders>
<w:top w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:left w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:bottom w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:right w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
</w:tcBorders>
<w:shd w:val="clear" w:color="auto" w:fill="D3DFEE"/>
<w:vAlign w:val="center"/>
</w:tcPr>
<w:p wsp:rsidR="00B6699A" wsp:rsidRPr="002C3EBD" wsp:rsidRDefault="00B6699A" wsp:rsidP="002C3EBD">
<w:pPr>
<w:pStyle w:val="A5"/>
<w:spacing w:before="156" w:after="156"/>
<w:ind w:first-line-chars="0" w:first-line="0"/>
<w:jc w:val="center"/>
<w:rPr>
<w:b/>
<w:b-cs/>
</w:rPr>
</w:pPr>
<w:r wsp:rsidRPr="002C3EBD">
<w:rPr>
<w:rFonts w:hint="fareast"/>
<w:b/>
<w:b-cs/>
</w:rPr>
<w:t>${pojo2_index+1}</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="992" w:type="dxa"/>
<w:tcBorders>
<w:top w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:left w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:bottom w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:right w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
</w:tcBorders>
<w:shd w:val="clear" w:color="auto" w:fill="D3DFEE"/>
<w:vAlign w:val="center"/>
</w:tcPr>
<w:p wsp:rsidR="00B6699A" wsp:rsidRPr="00CE1E0D" wsp:rsidRDefault="00B6699A" wsp:rsidP="002C3EBD">
<w:pPr>
<w:pStyle w:val="A5"/>
<w:spacing w:before="156" w:after="156"/>
<w:ind w:first-line-chars="0" w:first-line="0"/>
<w:jc w:val="center"/>
</w:pPr>
<w:r wsp:rsidRPr="0040529F">
<w:rPr>
<w:rFonts w:hint="fareast"/>
<wx:font wx:val="宋体"/>
</w:rPr>
<w:t>${pojo2.policyTag}</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="850" w:type="dxa"/>
<w:tcBorders>
<w:top w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:left w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:bottom w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:right w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
</w:tcBorders>
<w:shd w:val="clear" w:color="auto" w:fill="D3DFEE"/>
<w:vAlign w:val="center"/>
</w:tcPr>
<w:p wsp:rsidR="00B6699A" wsp:rsidRDefault="000E69CA" wsp:rsidP="002C3EBD">
<w:pPr>
<w:pStyle w:val="A5"/>
<w:spacing w:before="156" w:after="156"/>
<w:ind w:first-line-chars="0" w:first-line="0"/>
<w:jc w:val="center"/>
</w:pPr>
<w:proofErr w:type="gramStart"/>
<w:r>
<w:rPr>
<w:rFonts w:hint="fareast"/>
<wx:font wx:val="宋体"/>
</w:rPr>
<w:t>${pojo2.policyName}</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="2214" w:type="dxa"/>
<w:tcBorders>
<w:top w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:left w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:bottom w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:right w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
</w:tcBorders>
<w:shd w:val="clear" w:color="auto" w:fill="D3DFEE"/>
</w:tcPr>
<w:p wsp:rsidR="00B6699A" wsp:rsidRDefault="000E69CA" wsp:rsidP="002C3EBD">
<w:pPr>
<w:pStyle w:val="A5"/>
<w:spacing w:before="156" w:after="156"/>
<w:ind w:first-line-chars="0" w:first-line="0"/>
</w:pPr>
<w:proofErr w:type="gramStart"/>
<w:r>
<w:rPr>
<w:rFonts w:hint="fareast"/>
<wx:font wx:val="宋体"/>
</w:rPr>
<w:t>${pojo2.policyDescription}</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1219" w:type="dxa"/>
<w:tcBorders>
<w:top w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:left w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:bottom w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:right w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
</w:tcBorders>
<w:shd w:val="clear" w:color="auto" w:fill="D3DFEE"/>
</w:tcPr>
<w:p wsp:rsidR="00B6699A" wsp:rsidRDefault="000E69CA" wsp:rsidP="002C3EBD">
<w:pPr>
<w:pStyle w:val="A5"/>
<w:spacing w:before="156" w:after="156"/>
<w:ind w:first-line-chars="0" w:first-line="0"/>
</w:pPr>
<w:proofErr w:type="gramStart"/>
<w:r>
<w:rPr>
<w:rFonts w:hint="fareast"/>
<wx:font wx:val="宋体"/>
</w:rPr>
<w:t>${pojo2.ruleName}</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="820" w:type="dxa"/>
<w:tcBorders>
<w:top w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:left w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:bottom w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:right w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
</w:tcBorders>
<w:shd w:val="clear" w:color="auto" w:fill="D3DFEE"/>
</w:tcPr>
<w:p wsp:rsidR="00B6699A" wsp:rsidRDefault="000E69CA" wsp:rsidP="002C3EBD">
<w:pPr>
<w:pStyle w:val="A5"/>
<w:spacing w:before="156" w:after="156"/>
<w:ind w:first-line-chars="0" w:first-line="0"/>
</w:pPr>
<w:proofErr w:type="gramStart"/>
<w:r>
<w:rPr>
<w:rFonts w:hint="fareast"/>
<wx:font wx:val="宋体"/>
</w:rPr>
<w:t>${pojo2.expectedResult}</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="709" w:type="dxa"/>
<w:tcBorders>
<w:top w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:left w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:bottom w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:right w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
</w:tcBorders>
<w:shd w:val="clear" w:color="auto" w:fill="D3DFEE"/>
</w:tcPr>
<w:p wsp:rsidR="00B6699A" wsp:rsidRDefault="000E69CA" wsp:rsidP="002C3EBD">
<w:pPr>
<w:pStyle w:val="A5"/>
<w:spacing w:before="156" w:after="156"/>
<w:ind w:first-line-chars="0" w:first-line="0"/>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:hint="fareast"/>
<wx:font wx:val="宋体"/>
</w:rPr>
<w:t>${pojo2.result?string("yes", "no")}</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1184" w:type="dxa"/>
<w:tcBorders>
<w:top w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:left w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:bottom w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
<w:right w:val="single" w:sz="8" wx:bdrwidth="20" w:space="0" w:color="4F81BD"/>
</w:tcBorders>
<w:shd w:val="clear" w:color="auto" w:fill="D3DFEE"/>
</w:tcPr>
<w:p wsp:rsidR="00B6699A" wsp:rsidRDefault="000E69CA" wsp:rsidP="002C3EBD">
<w:pPr>
<w:pStyle w:val="A5"/>
<w:spacing w:before="156" w:after="156"/>
<w:ind w:first-line-chars="0" w:first-line="0"/>
</w:pPr>
<w:proofErr w:type="gramStart"/>
<w:r>
<w:rPr>
<w:rFonts w:hint="fareast"/>
<wx:font wx:val="宋体"/>
</w:rPr>
<w:t>${pojo2.recommendations}</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
</#list>