FreeMarker支持多种模板装载方法
1、使用word2003把自己需要导出word模版
![](https://i-blog.csdnimg.cn/blog_migrate/701c5b00413f7f6b199446157f3ef608.png)
模版创建好,另存为xml格式,勾选仅保存数据。弹出提示点击“保存wordXML格式”。
可以看到xml文件,使用文本编辑器打开
<?xml version="1.0" encoding="utf-8"?>
<?mso-application progid="Word.Document"?>
<w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" 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: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>njzaizao</o:Author>
<o:LastAuthor>njzaizao</o:LastAuthor>
<o:Revision>2</o:Revision>
<o:TotalTime>1</o:TotalTime>
<o:Created>2017-01-11T03:09:00Z</o:Created>
<o:LastSaved>2017-01-11T03:09:00Z</o:LastSaved>
<o:Pages>1</o:Pages>
<o:Words>6</o:Words>
<o:Characters>37</o:Characters>
<o:Lines>1</o:Lines>
<o:Paragraphs>1</o:Paragraphs>
<o:CharactersWithSpaces>42</o:CharactersWithSpaces>
<o:Version>14</o:Version>
</o:DocumentProperties>
<o:CustomDocumentProperties>
<o:KSOProductBuildVer dt:dt="string">2052-10.1.0.6028</o:KSOProductBuildVer>
</o:CustomDocumentProperties>
<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="宋体">
<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="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="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="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="HTML Top of Form"/>
<w:lsdException w:name="HTML Bottom of Form"/>
<w:lsdException w:name="Normal Table"/>
<w:lsdException w:name="No List"/>
<w:lsdException w:name="Outline List 1"/>
<w:lsdException w:name="Outline List 2"/>
<w:lsdException w:name="Outline List 3"/>
<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:pPr>
<w:widowControl w:val="off"/>
<w:jc w:val="both"/>
</w:pPr>
<w:rPr>
<wx:font wx:val="Calibri"/>
<w:kern w:val="2"/>
<w:sz w:val="21"/>
<w:sz-cs w:val="24"/>
<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="table" w:styleId="a3">
<w:name w:val="Table Grid"/>
<wx:uiName wx:val="网格型"/>
<w:basedOn w:val="a1"/>
<w:pPr>
<w:widowControl w:val="off"/>
<w:jc w:val="both"/>
</w:pPr>
<w:rPr>
<wx:font wx:val="Calibri"/>
</w:rPr>
<w:tblPr>
<w:tblInd w:w="0" 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:insideH w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto"/>
<w:insideV w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto"/>
</w:tblBorders>
<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:styles>
<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="90"/>
<w:dontDisplayPageBoundaries/>
<w:bordersDontSurroundHeader/>
<w:bordersDontSurroundFooter/>
<w:proofState w:spelling="clean" w:grammar="clean"/>
<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: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="00C6198F"/>
<wsp:rsid wsp:val="00173FBA"/>
<wsp:rsid wsp:val="001A2B16"/>
<wsp:rsid wsp:val="007D0A64"/>
<wsp:rsid wsp:val="009B404F"/>
<wsp:rsid wsp:val="00C6198F"/>
<wsp:rsid wsp:val="6B7C7F73"/>
</wsp:rsids>
</w:docPr>
<#list newsList as user>
<w:body>
<wx:sect>
<w:tbl>
<w:tblPr>
<w:tblW w:w="8522" 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:insideH w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto"/>
<w:insideV w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto"/>
</w:tblBorders>
<w:tblLayout w:type="Fixed"/>
<w:tblLook w:val="04A0"/>
</w:tblPr>
<w:tblGrid>
<w:gridCol w:w="1420"/>
<w:gridCol w:w="1420"/>
<w:gridCol w:w="1420"/>
<w:gridCol w:w="1420"/>
<w:gridCol w:w="1421"/>
<w:gridCol w:w="1421"/>
</w:tblGrid>
<w:tr wsp:rsidR="007D0A64" wsp:rsidRPr="001A2B16" wsp:rsidTr="001A2B16">
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
${user.vip_name?if_exists}
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1421" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1421" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
</w:tr>
<w:tr wsp:rsidR="007D0A64" wsp:rsidRPr="001A2B16" wsp:rsidTr="001A2B16">
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1421" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1421" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
</w:tr>
<w:tr wsp:rsidR="007D0A64" wsp:rsidRPr="001A2B16" wsp:rsidTr="001A2B16">
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1421" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1421" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
</w:tr>
<w:tr wsp:rsidR="007D0A64" wsp:rsidRPr="001A2B16" wsp:rsidTr="001A2B16">
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1421" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1421" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
</w:tr>
<w:tr wsp:rsidR="007D0A64" wsp:rsidRPr="001A2B16" wsp:rsidTr="001A2B16">
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1421" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1421" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
</w:tr>
<w:tr wsp:rsidR="007D0A64" wsp:rsidRPr="001A2B16" wsp:rsidTr="001A2B16">
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1420" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1421" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1421" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
</w:tcPr>
<w:p wsp:rsidR="00C6198F" wsp:rsidRPr="001A2B16" wsp:rsidRDefault="00C6198F"/>
</w:tc>
</w:tr>
</w:tbl>
<w:p wsp:rsidR="00C6198F" wsp:rsidRDefault="00C6198F"/>
<w:sectPr wsp:rsidR="00C6198F">
<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>
</w:body>
</#list>
</w:wordDocument>
<#list newsList as user> 其中 list 是一个集合 user是集合里的对象
${user.vip_name?if_exists} 这里表示从user中获取 vip_name
?if_exists表示没有值则是空
/**
* 传入数据 可直接本地生成word
*
* @param dataMap
*/
public void createBoxDoc(Map<String, Object> dataMap) {
// 设置模本装置方法和路径,FreeMarker支持多种模板装载方法。可以重servlet,classpath,数据库装载,
// ftl文件存放路径
File file = new File(path);
try {
configuration.setDirectoryForTemplateLoading(file);
} catch (IOException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
Template t = null;
try {
// test.ftl为要装载的模板
t = configuration.getTemplate("box.ftl");
t.setEncoding("utf-8");
} catch (IOException e) {
e.printStackTrace();
}
String fileName = this.getWordId() + ".doc";
// 输出文档路径及名称
File outFile = new File(path+"/" + fileName);
list.add(fileName);
Writer out = null;
try {
out = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(outFile), "utf-8"));
} catch (Exception e1) {
e1.printStackTrace();
}
try {
t.process(dataMap, out);
out.close();
} catch (TemplateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
生成word