JAVA根据ftl模板生成需要的多表格word文档

效果如下图:



第一步:编辑模板


第二步:另存为xml格式


第三步:改为ftl模板格式,并编辑ftl模板


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?mso-application progid="Word.Document"?>
<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>郑加威</o:Author>
<o:LastAuthor>郑加威</o:LastAuthor>
<o:Revision>2</o:Revision>
<o:TotalTime>0</o:TotalTime>
<o:Created>2014-12-08T12:37:00Z</o:Created>
<o:LastSaved>2014-12-08T12:37:00Z</o:LastSaved>
<o:Pages>1</o:Pages>
<o:Words>30</o:Words>
<o:Characters>177</o:Characters>
<o:Company>微软中国</o:Company>
<o:Lines>1</o:Lines>
<o:Paragraphs>1</o:Paragraphs>
<o:CharactersWithSpaces>206</o:CharactersWithSpaces>
<o:Version>15</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="SimHei"/>
<w:panose-1 w:val="02010609060101010101"/>
<w:charset w:val="86"/>
<w:family w:val="Modern"/>
<w:pitch w:val="fixed"/>
<w:sig w:usb-0="800002BF" w:usb-1="38CF7CFA" w:usb-2="00000016" w:usb-3="00000000" w:csb-0="00040001" w:csb-1="00000000"/>
</w:font>
<w:font w:name="Cambria Math">
<w:panose-1 w:val="02040503050406030204"/>
<w:charset w:val="01"/>
<w:family w:val="Roman"/>
<w:notTrueType/>
<w:pitch w:val="variable"/>
</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="E10002FF" w:usb-1="4000ACFF" w:usb-2="00000009" w:usb-3="00000000" w:csb-0="0000019F" w:csb-1="00000000"/>
</w:font>
<w:font w:name="@黑体">
<w:panose-1 w:val="02010609060101010101"/>
<w:charset w:val="86"/>
<w:family w:val="Modern"/>
<w:pitch w:val="fixed"/>
<w:sig w:usb-0="800002BF" w:usb-1="38CF7CFA" w:usb-2="00000016" w:usb-3="00000000" w:csb-0="00040001" 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:lists>
<w:listDef w:listDefId="0">
<w:lsid w:val="1E850E47"/>
<w:plt w:val="Multilevel"/>
<w:tmpl w:val="04090025"/>
<w:lvl w:ilvl="0">
<w:start w:val="1"/>
<w:pStyle w:val="1"/>
<w:lvlText w:val="%1"/>
<w:lvlJc w:val="left"/>
<w:pPr>
<w:tabs>
<w:tab w:val="list" w:pos="432"/>
</w:tabs>
<w:ind w:left="432" w:hanging="432"/>
</w:pPr>
<w:rPr>
<w:rFonts w:hint="fareast"/>
</w:rPr>
</w:lvl>
<w:lvl w:ilvl="1">
<w:start w:val="1"/>
<w:pStyle w:val="2"/>
<w:lvlText w:val="%1.%2"/>
<w:lvlJc w:val="left"/>
<w:pPr>
<w:tabs>
<w:tab w:val="list" w:pos="576"/>
</w:tabs>
<w:ind w:left="576" w:hanging="576"/>
</w:pPr>
<w:rPr>
<w:rFonts w:hint="fareast"/>
</w:rPr>
</w:lvl>
<w:lvl w:ilvl="2">
<w:start w:val="1"/>
<w:pStyle w:val="3"/>
<w:lvlText w:val="%1.%2.%3"/>
<w:lvlJc w:val="left"/>
<w:pPr>
<w:tabs>
<w:tab w:val="list" w:pos="720"/>
</w:tabs>
<w:ind w:left="720" w:hanging="720"/>
</w:pPr>
<w:rPr>
<w:rFonts w:hint="fareast"/>
</w:rPr>
</w:lvl>
<w:lvl w:ilvl="3">
<w:start w:val="1"/>
<w:pStyle w:val="4"/>
<w:lvlText w:val="%1.%2.%3.%4"/>
<w:lvlJc w:val="left"/>
<w:pPr>
<w:tabs>
<w:tab w:val="list" w:pos="864"/>
</w:tabs>
<w:ind w:left="864" w:hanging="864"/>
</w:pPr>
<w:rPr>
<w:rFonts w:hint="fareast"/>
</w:rPr>
</w:lvl>
<w:lvl w:ilvl="4">
<w:start w:val="1"/>
<w:pStyle w:val="5"/>
<w:lvlText w:val="%1.%2.%3.%4.%5"/>
<w:lvlJc w:val="left"/>
<w:pPr>
<w:tabs>
<w:tab w:val="list" w:pos="1008"/>
</w:tabs>
<w:ind w:left="1008" w:hanging="1008"/>
</w:pPr>
<w:rPr>
<w:rFonts w:hint="fareast"/>
</w:rPr>
</w:lvl>
<w:lvl w:ilvl="5">
<w:start w:val="1"/>
<w:pStyle w:val="6"/>
<w:lvlText w:val="%1.%2.%3.%4.%5.%6"/>
<w:lvlJc w:val="left"/>
<w:pPr>
<w:tabs>
<w:tab w:val="list" w:pos="1152"/>
</w:tabs>
<w:ind w:left="1152" w:hanging="1152"/>
</w:pPr>
<w:rPr>
<w:rFonts w:hint="fareast"/>
</w:rPr>
</w:lvl>
<w:lvl w:ilvl="6">
<w:start w:val="1"/>
<w:pStyle w:val="7"/>
<w:lvlText w:val="%1.%2.%3.%4.%5.%6.%7"/>
<w:lvlJc w:val="left"/>
<w:pPr>
<w:tabs>
<w:tab w:val="list" w:pos="1296"/>
</w:tabs>
<w:ind w:left="1296" w:hanging="1296"/>
</w:pPr>
<w:rPr>
<w:rFonts w:hint="fareast"/>
</w:rPr>
</w:lvl>
<w:lvl w:ilvl="7">
<w:start w:val="1"/>
<w:pStyle w:val="8"/>
<w:lvlText w:val="%1.%2.%3.%4.%5.%6.%7.%8"/>
<w:lvlJc w:val="left"/>
<w:pPr>
<w:tabs>
<w:tab w:val="list" w:pos="1440"/>
</w:tabs>
<w:ind w:left="1440" w:hanging="1440"/>
</w:pPr>
<w:rPr>
<w:rFonts w:hint="fareast"/>
</w:rPr>
</w:lvl>
<w:lvl w:ilvl="8">
<w:start w:val="1"/>
<w:pStyle w:val="9"/>
<w:lvlText w:val="%1.%2.%3.%4.%5.%6.%7.%8.%9"/>
<w:lvlJc w:val="left"/>
<w:pPr>
<w:tabs>
<w:tab w:val="list" w:pos="1584"/>
</w:tabs>
<w:ind w:left="1584" w:hanging="1584"/>
</w:pPr>
<w:rPr>
<w:rFonts w:hint="fareast"/>
</w:rPr>
</w:lvl>
</w:listDef>
<w:list w:ilfo="1">
<w:ilst w:val="0"/>
</w:list>
</w:lists>
<w:styles>
<w:versionOfBuiltInStylenames w:val="7"/>
<w:latentStyles w:defLockedState="off" w:latentStyleCount="371">
<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="index 1"/>
<w:lsdException w:name="index 2"/>
<w:lsdException w:name="index 3"/>
<w:lsdException w:name="index 4"/>
<w:lsdException w:name="index 5"/>
<w:lsdException w:name="index 6"/>
<w:lsdException w:name="index 7"/>
<w:lsdException w:name="index 8"/>
<w:lsdException w:name="index 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="Normal Indent"/>
<w:lsdException w:name="footnote text"/>
<w:lsdException w:name="annotation text"/>
<w:lsdException w:name="header"/>
<w:lsdException w:name="footer"/>
<w:lsdException w:name="index heading"/>
<w:lsdException w:name="caption"/>
<w:lsdException w:name="table of figures"/>
<w:lsdException w:name="envelope address"/>
<w:lsdException w:name="envelope return"/>
<w:lsdException w:name="footnote reference"/>
<w:lsdException w:name="annotation reference"/>
<w:lsdException w:name="line number"/>
<w:lsdException w:name="page number"/>
<w:lsdException w:name="endnote reference"/>
<w:lsdException w:name="endnote text"/>
<w:lsdException w:name="table of authorities"/>
<w:lsdException w:name="macro"/>
<w:lsdException w:name="toa heading"/>
<w:lsdException w:name="List"/>
<w:lsdException w:name="List Bullet"/>
<w:lsdException w:name="List Number"/>
<w:lsdException w:name="List 2"/>
<w:lsdException w:name="List 3"/>
<w:lsdException w:name="List 4"/>
<w:lsdException w:name="List 5"/>
<w:lsdException w:name="List Bullet 2"/>
<w:lsdException w:name="List Bullet 3"/>
<w:lsdException w:name="List Bullet 4"/>
<w:lsdException w:name="List Bullet 5"/>
<w:lsdException w:name="List Number 2"/>
<w:lsdException w:name="List Number 3"/>
<w:lsdException w:name="List Number 4"/>
<w:lsdException w:name="List Number 5"/>
<w:lsdException w:name="Title"/>
<w:lsdException w:name="Closing"/>
<w:lsdException w:name="Signature"/>
<w:lsdException w:name="Default Paragraph Font"/>
<w:lsdException w:name="Body Text"/>
<w:lsdException w:name="Body Text Indent"/>
<w:lsdException w:name="List Continue"/>
<w:lsdException w:name="List Continue 2"/>
<w:lsdException w:name="List Continue 3"/>
<w:lsdException w:name="List Continue 4"/>
<w:lsdException w:name="List Continue 5"/>
<w:lsdException w:name="Message Header"/>
<w:lsdException w:name="Subtitle"/>
<w:lsdException w:name="Salutation"/>
<w:lsdException w:name="Date"/>
<w:lsdException w:name="Body Text First Indent"/>
<w:lsdException w:name="Body Text First Indent 2"/>
<w:lsdException w:name="Note Heading"/>
<w:lsdException w:name="Body Text 2"/>
<w:lsdException w:name="Body Text 3"/>
<w:lsdException w:name="Body Text Indent 2"/>
<w:lsdException w:name="Body Text Indent 3"/>
<w:lsdException w:name="Block Text"/>
<w:lsdException w:name="Hyperlink"/>
<w:lsdException
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值