使用freemark来实现

yml配置文件:

springboot 导出下载excel报错时返回错误信息 springboot 导出word_word导出


template-loader-path: classpath:/templates/ftl/ 这个是配置模板所在的位置

这里的配置要是带"/“则获取模板的时候模板名称前不用加”/"首先准备好需要导出的word模板,注意该模板最好是最终版,因为稍微的样式改动都得重新生成模板

模板如下:

springboot 导出下载excel报错时返回错误信息 springboot 导出word_office打开乱码_02


赋值的地方最好先添加上标识,便于模板生成之后找对应的字段替换,切记不要使用wps!如果需要赋的值带有html标签的话,模板另存为mht后缀的文件,如果仅是简单的字段替换,模板生成xml格式即可。注意在保存的时候要保存成utf-8编码集的,具体操作请自行百度。

生成的模板:

MIME-Version: 1.0
Content-Type: multipart/related; boundary="----=_NextPart_01D531BC.80714FE0"

此文档为“单个文件网页”,也称为“Web 档案”文件。如果您看到此消息,但是您的浏览器或编辑器不支持“Web 档案”文件。请下载支持“Web 档案”的浏览器,如 Windows? Internet Explorer?。

------=_NextPart_01D531BC.80714FE0
Content-Location: file:///C:/4071C90C/file8860.htm
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="us-ascii"

<html xmlns:v=3D"urn:schemas-microsoft-com:vml"
xmlns:o=3D"urn:schemas-microsoft-com:office:office"
xmlns:w=3D"urn:schemas-microsoft-com:office:word"
xmlns:dt=3D"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml"
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
<meta name=3DProgId content=3DWord.Document>
<meta name=3DGenerator content=3D"Microsoft Word 14">
<meta name=3DOriginator content=3D"Microsoft Word 14">
<link rel=3DFile-List href=3D"file8860.files/filelist.xml">
<!--[if gte mso 9]><xml>
 <o:DocumentProperties>
  <o:Author>USER-</o:Author>
  <o:LastAuthor>k</o:LastAuthor>
  <o:Revision>2</o:Revision>
  <o:TotalTime>5</o:TotalTime>
  <o:Created>2019-07-03T08:29:00Z</o:Created>
  <o:LastSaved>2019-07-03T08:29:00Z</o:LastSaved>
  <o:Pages>2</o:Pages>
  <o:Words>27</o:Words>
  <o:Characters>156</o:Characters>
  <o:Company>MS</o:Company>
  <o:Lines>1</o:Lines>
  <o:Paragraphs>1</o:Paragraphs>
  <o:CharactersWithSpaces>182</o:CharactersWithSpaces>
  <o:Version>14.00</o:Version>
 </o:DocumentProperties>
 <o:CustomDocumentProperties>
  <o:KSOProductBuildVer dt:dt=3D"string">2052-10.1.0.7346</o:KSOProductBuil=
dVer>
 </o:CustomDocumentProperties>
</xml><![endif]-->
<link rel=3DdataStoreItem href=3D"file8860.files/item0001.xml"
target=3D"file8860.files/props002.xml">
<link rel=3DthemeData href=3D"file8860.files/themedata.thmx">
<link rel=3DcolorSchemeMapping href=3D"file8860.files/colorschememapping.xm=
l">
<!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:View>Print</w:View>
  <w:Zoom>120</w:Zoom>
  <w:TrackMoves>false</w:TrackMoves>
  <w:TrackFormatting/>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:DoNotPromoteQF/>
  <w:LidThemeOther>EN-US</w:LidThemeOther>
  <w:LidThemeAsian>ZH-CN</w:LidThemeAsian>
  <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
  <w:Compatibility>
   <w:DoNotExpandShiftReturn/>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:DontGrowAutofit/>
   <w:DontUseIndentAsNumberingTabStop/>
   <w:FELineBreak11/>
   <w:SplitPgBreakAndParaMark/>
   <w:EnableOpenTypeKerning/>
   <w:DontFlipMirrorIndents/>
   <w:OverrideTableStyleHps/>
   <w:UseFELayout/>
  </w:Compatibility>
  <w:DoNotOptimizeForBrowser/>
  <m:mathPr>
   <m:mathFont m:val=3D"Cambria Math"/>
   <m:brkBin m:val=3D"before"/>
   <m:brkBinSub m:val=3D"--"/>
   <m:smallFrac m:val=3D"off"/>
   <m:dispDef/>
   <m:lMargin m:val=3D"0"/>
   <m:rMargin m:val=3D"0"/>
   <m:defJc m:val=3D"centerGroup"/>
   <m:wrapIndent m:val=3D"1440"/>
   <m:intLim m:val=3D"subSup"/>
   <m:naryLim m:val=3D"undOvr"/>
  </m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState=3D"false" DefUnhideWhenUsed=3D"true"
  DefSemiHidden=3D"true" DefQFormat=3D"false" DefPriority=3D"99"
  LatentStyleCount=3D"267">
  <w:LsdException Locked=3D"false" Priority=3D"0" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" QFormat=3D"true" Name=3D"Normal"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" QFormat=3D"true" Name=3D"heading 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" QFormat=3D"true" Name=3D"=
heading 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" QFormat=3D"true" Name=3D"=
heading 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" QFormat=3D"true" Name=3D"=
heading 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" QFormat=3D"true" Name=3D"=
heading 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" QFormat=3D"true" Name=3D"=
heading 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" QFormat=3D"true" Name=3D"=
heading 7"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" QFormat=3D"true" Name=3D"=
heading 8"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" QFormat=3D"true" Name=3D"=
heading 9"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" Name=3D"toc 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" Name=3D"toc 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" Name=3D"toc 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" Name=3D"toc 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" Name=3D"toc 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" Name=3D"toc 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" Name=3D"toc 7"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" Name=3D"toc 8"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" Name=3D"toc 9"/>
  <w:LsdException Locked=3D"false" Priority=3D"35" QFormat=3D"true" Name=3D=
"caption"/>
  <w:LsdException Locked=3D"false" Priority=3D"10" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" QFormat=3D"true" Name=3D"Title"/>
  <w:LsdException Locked=3D"false" Priority=3D"1" Name=3D"Default Paragraph=
 Font"/>
  <w:LsdException Locked=3D"false" Priority=3D"11" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" QFormat=3D"true" Name=3D"Subtitle"/>
  <w:LsdException Locked=3D"false" QFormat=3D"true" Name=3D"Hyperlink"/>
  <w:LsdException Locked=3D"false" QFormat=3D"true" Name=3D"FollowedHyperli=
nk"/>
  <w:LsdException Locked=3D"false" Priority=3D"22" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" QFormat=3D"true" Name=3D"Strong"/>
  <w:LsdException Locked=3D"false" Priority=3D"20" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" QFormat=3D"true" Name=3D"Emphasis"/>
  <w:LsdException Locked=3D"false" QFormat=3D"true" Name=3D"Normal (Web)"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Table Grid"/>
  <w:LsdException Locked=3D"false" Priority=3D"60" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light Shading"/>
  <w:LsdException Locked=3D"false" Priority=3D"61" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light List"/>
  <w:LsdException Locked=3D"false" Priority=3D"62" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light Grid"/>
  <w:LsdException Locked=3D"false" Priority=3D"63" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Shading 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"64" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Shading 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"65" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium List 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"66" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium List 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"67" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"68" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"69" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"70" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Dark List"/>
  <w:LsdException Locked=3D"false" Priority=3D"71" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful Shading"/>
  <w:LsdException Locked=3D"false" Priority=3D"72" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful List"/>
  <w:LsdException Locked=3D"false" Priority=3D"73" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful Grid"/>
  <w:LsdException Locked=3D"false" Priority=3D"60" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light Shading Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"61" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light List Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"62" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light Grid Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"63" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Shading 1 Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"64" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Shading 2 Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"65" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium List 1 Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"66" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium List 2 Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"67" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 1 Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"68" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 2 Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"69" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 3 Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"70" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Dark List Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"71" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful Shading Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"72" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful List Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"73" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful Grid Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"60" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light Shading Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"61" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light List Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"62" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light Grid Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"63" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Shading 1 Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"64" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Shading 2 Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"65" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium List 1 Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"66" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium List 2 Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"67" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 1 Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"68" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 2 Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"69" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 3 Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"70" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Dark List Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"71" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful Shading Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"72" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful List Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"73" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful Grid Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"60" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light Shading Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"61" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light List Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"62" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light Grid Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"63" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Shading 1 Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"64" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Shading 2 Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"65" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium List 1 Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"66" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium List 2 Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"67" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 1 Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"68" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 2 Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"69" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 3 Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"70" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Dark List Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"71" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful Shading Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"72" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful List Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"73" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful Grid Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"60" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light Shading Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"61" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light List Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"62" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light Grid Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"63" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Shading 1 Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"64" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Shading 2 Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"65" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium List 1 Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"66" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium List 2 Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"67" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 1 Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"68" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 2 Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"69" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 3 Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"70" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Dark List Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"71" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful Shading Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"72" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful List Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"73" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful Grid Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"60" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light Shading Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"61" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light List Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"62" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light Grid Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"63" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Shading 1 Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"64" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Shading 2 Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"65" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium List 1 Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"66" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium List 2 Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"67" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 1 Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"68" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 2 Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"69" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 3 Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"70" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Dark List Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"71" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful Shading Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"72" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful List Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"73" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful Grid Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"60" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light Shading Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"61" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light List Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"62" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Light Grid Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"63" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Shading 1 Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"64" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Shading 2 Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"65" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium List 1 Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"66" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium List 2 Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"67" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 1 Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"68" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 2 Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"69" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Medium Grid 3 Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"70" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Dark List Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"71" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful Shading Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"72" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful List Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"73" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" Name=3D"Colorful Grid Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"19" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" QFormat=3D"true" Name=3D"Subtle Emphasis"/>
  <w:LsdException Locked=3D"false" Priority=3D"21" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" QFormat=3D"true" Name=3D"Intense Emphasis"/>
  <w:LsdException Locked=3D"false" Priority=3D"31" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" QFormat=3D"true" Name=3D"Subtle Reference"/>
  <w:LsdException Locked=3D"false" Priority=3D"32" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" QFormat=3D"true" Name=3D"Intense Reference"/>
  <w:LsdException Locked=3D"false" Priority=3D"33" SemiHidden=3D"false"
   UnhideWhenUsed=3D"false" QFormat=3D"true" Name=3D"Book Title"/>
  <w:LsdException Locked=3D"false" Priority=3D"37" Name=3D"Bibliography"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" QFormat=3D"true" Name=3D=
"TOC Heading"/>
 </w:LatentStyles>
</xml><![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:SimSun;
	panose-1:2 1 6 0 3 1 1 1 1 1;
	mso-font-alt:SimSun;
	mso-font-charset:134;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 680460288 22 0 262145 0;}
@font-face
	{font-family:SimSun;
	panose-1:2 1 6 0 3 1 1 1 1 1;
	mso-font-alt:SimSun;
	mso-font-charset:134;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 680460288 22 0 262145 0;}
@font-face
	{font-family:SimSun;
	panose-1:2 1 6 0 3 1 1 1 1 1;
	mso-font-charset:134;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 680460288 22 0 262145 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:"";
	margin:0cm;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:SimSun;
	mso-bidi-font-family:SimSun;}
a:link, span.MsoHyperlink
	{mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-qformat:yes;
	color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-qformat:yes;
	color:purple;
	text-decoration:underline;
	text-underline:single;}
p
	{mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-qformat:yes;
	mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:SimSun;
	mso-bidi-font-family:SimSun;}
p.msonormal0, li.msonormal0, div.msonormal0
	{mso-style-name:msonormal;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:SimSun;
	mso-bidi-font-family:SimSun;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	font-size:10.0pt;
	mso-ansi-font-size:10.0pt;
	mso-bidi-font-size:10.0pt;
	mso-ascii-font-family:"Times New Roman";
	mso-fareast-font-family:SimSun;
	mso-hansi-font-family:"Times New Roman";
	mso-font-kerning:0pt;}
@page WordSection1
	{size:592.5pt 839.15pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	mso-header-margin:42.55pt;
	mso-footer-margin:49.6pt;
	mso-paper-source:0;}
div.WordSection1
	{page:WordSection1;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:\666E\901A\8868\683C;
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-parent:"";
	mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
	mso-para-margin:0cm;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman","serif";}
</style>
<![endif]--><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext=3D"edit">
  <o:idmap v:ext=3D"edit" data=3D"1"/>
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=3DZH-CN link=3Dblue vlink=3Dpurple style=3D'tab-interval:21.0pt'>

<div class=3DWordSection1>

<#list dataList! as item>
    <div align=3Dcenter>

    <table class=3DMsoNormalTable border=3D1 cellspacing=3D0 cellpadding=3D0 wi=
    dth=3D585
     style=3D'border-collapse:collapse;mso-table-layout-alt:fixed;border:none;
     mso-border-alt:outset #333333 .75pt;mso-yfti-tbllook:1184;mso-padding-alt:
     0cm 0cm 0cm 0cm'>
     <tr style=3D'mso-yfti-irow:0;mso-yfti-firstrow:yes;height:49.0pt'>
      <td width=3D107 style=3D'width:79.9pt;border:solid windowtext 1.0pt;mso-b=
    order-alt:
      solid windowtext .5pt;background:#E8E8E8;padding:0cm 0cm 0cm 3.75pt;
      height:49.0pt'>
      <p class=3DMsoNormal><b><span style=3D'font-size:10.5pt'>序号=
    <span
      lang=3DEN-US><o:p></o:p></span></span></b></p>
      </td>
      <td width=3D479 style=3D'width:359.1pt;border:solid windowtext 1.0pt;bord=
    er-left:
      none;mso-border-left-alt:solid windowtext .5pt;mso-border-alt:solid windo=
    wtext .5pt;
      padding:0cm 0cm 0cm 0cm;height:49.0pt'>
      <p class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:10.5pt'>${item_index?if_exists+1}=
    <o:p></o:p></span></p>
      </td>
     </tr>
     <tr style=3D'mso-yfti-irow:1;height:49.0pt'>
      <td width=3D107 style=3D'width:79.9pt;border:solid windowtext 1.0pt;borde=
    r-top:
      none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid window=
    text .5pt;
      background:#E8E8E8;padding:0cm 0cm 0cm 3.75pt;height:49.0pt'>
      <p class=3DMsoNormal><b><span style=3D'font-size:10.5pt'>公告=
    名称<span
      lang=3DEN-US><o:p></o:p></span></span></b></p>
      </td>
      <td width=3D479 style=3D'width:359.1pt;border-top:none;border-left:none;
      border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
      mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid window=
    text .5pt;
      mso-border-alt:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm;height:49.0p=
    t'>
      <p class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:10.5pt'>${item.project_name!}=
    <o:p></o:p></span></p>
      </td>
     </tr>
     <tr style=3D'mso-yfti-irow:2;height:49.0pt'>
      <td width=3D107 style=3D'width:79.9pt;border:solid windowtext 1.0pt;borde=
    r-top:
      none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid window=
    text .5pt;
      background:#E8E8E8;padding:0cm 0cm 0cm 3.75pt;height:49.0pt'>
      <p class=3DMsoNormal><b><span style=3D'font-size:10.5pt'>地区=
    <span
      lang=3DEN-US><o:p></o:p></span></span></b></p>
      </td>
      <td width=3D479 style=3D'width:359.1pt;border-top:none;border-left:none;
      border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
      mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid window=
    text .5pt;
      mso-border-alt:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm;height:49.0p=
    t'>
      <p class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:10.5pt'>${item.region!}=
    <o:p></o:p></span></p>
      </td>
     </tr>
     <tr style=3D'mso-yfti-irow:3;height:49.0pt'>
      <td width=3D107 style=3D'width:79.9pt;border:solid windowtext 1.0pt;borde=
    r-top:
      none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid window=
    text .5pt;
      background:#E8E8E8;padding:0cm 0cm 0cm 3.75pt;height:49.0pt'>
      <p class=3DMsoNormal><b><span style=3D'font-size:10.5pt'>发布=
    时间<span
      lang=3DEN-US><o:p></o:p></span></span></b></p>
      </td>
      <td width=3D479 style=3D'width:359.1pt;border-top:none;border-left:none;
      border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
      mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid window=
    text .5pt;
      mso-border-alt:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm;height:49.0p=
    t'>
      <p class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:10.5pt'>${item.publish_date_str!}=
    <o:p></o:p></span></p>
      </td>
     </tr>
     <tr style=3D'mso-yfti-irow:4;height:49.0pt'>
      <td width=3D107 style=3D'width:79.9pt;border:solid windowtext 1.0pt;borde=
    r-top:
      none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid window=
    text .5pt;
      background:#E8E8E8;padding:0cm 0cm 0cm 3.75pt;height:49.0pt'>
      <p class=3DMsoNormal><b><span style=3D'font-size:10.5pt'>招标=
    单位<span
      lang=3DEN-US><o:p></o:p></span></span></b></p>
      </td>
      <td width=3D479 style=3D'width:359.1pt;border-top:none;border-left:none;
      border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
      mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid window=
    text .5pt;
      mso-border-alt:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm;height:49.0p=
    t'>
      <p class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:10.5pt'>${item.tender!}=
    <o:p></o:p></span></p>
      </td>
     </tr>
     <tr style=3D'mso-yfti-irow:5;mso-yfti-lastrow:yes;height:415.15pt'>
      <td width=3D107 style=3D'width:79.9pt;border:solid windowtext 1.0pt;borde=
    r-top:
      none;mso-border-top-alt:solid windowtext .5pt;mso-border-alt:solid window=
    text .5pt;
      background:#E8E8E8;padding:0cm 0cm 0cm 3.75pt;height:415.15pt'>
      <p class=3DMsoNormal><b><span style=3D'font-size:10.5pt'>招标=
    正文:<span
      lang=3DEN-US><o:p></o:p></span></span></b></p>
      </td>
      <td width=3D479 style=3D'width:359.1pt;border-top:none;border-left:none;
      border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
      mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid window=
    text .5pt;
      mso-border-alt:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm;height:415.1=
    5pt'>
      <p class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:10.5pt'>${item.content!}=
    <o:p></o:p></span></p>
      </td>
     </tr>
    </table>

    </div>

    <p class=3DMsoNormal><b><span lang=3DEN-US style=3D'font-size:10.5pt'><o:p>=
     </o:p></span></b></p>

    <p class=3DMsoNormal><b><span lang=3DEN-US style=3D'font-size:10.5pt'><o:p>=
     </o:p></span></b></p>

    <p class=3DMsoNormal><b><span lang=3DEN-US style=3D'font-size:10.5pt'><o:p>=
     </o:p></span></b></p>
</#list>

</div>

</body>

</html>

------=_NextPart_01D531BC.80714FE0
Content-Location: file:///C:/4071C90C/file8860.files/item0001.xml
Content-Transfer-Encoding: quoted-printable
Content-Type: text/xml

<?xml version=3D"1.0" encoding=3D"UTF-8" standalone=3D"yes"?><s:customData =
xmlns=3D"http://www.wps.cn/officeDocument/2013/wpsCustomData" xmlns:s=3D"ht=
tp://www.wps.cn/officeDocument/2013/wpsCustomData"><customSectProps><custom=
SectPr/></customSectProps></s:customData>
------=_NextPart_01D531BC.80714FE0
Content-Location: file:///C:/4071C90C/file8860.files/props002.xml
Content-Transfer-Encoding: quoted-printable
Content-Type: text/xml

<?xml version=3D"1.0" encoding=3D"UTF-8" standalone=3D"no"?>
<ds:datastoreItem ds:itemID=3D"{B1977F7D-205B-4081-913C-38D41E755F92}" xmln=
s:ds=3D"http://schemas.openxmlformats.org/officeDocument/2006/customXml"><d=
s:schemaRefs><ds:schemaRef ds:uri=3D"http://www.wps.cn/officeDocument/2013/=
wpsCustomData"/></ds:schemaRefs></ds:datastoreItem>
------=_NextPart_01D531BC.80714FE0
Content-Location: file:///C:/4071C90C/file8860.files/themedata.thmx
Content-Transfer-Encoding: base64
Content-Type: application/vnd.ms-officetheme

UEsDBBQABgAIAAAAIQDp3g+//wAAABwCAAATAAAAW0NvbnRlbnRfVHlwZXNdLnhtbKyRy07DMBBF
90j8g+UtSpyyQAgl6YLHjseifMDImSQWydiyp1X790zSVEKoIBZsLNkz954743K9Hwe1w5icp0qv
8kIrJOsbR12l3zdP2a1WiYEaGDxhpQ+Y9Lq+vCg3h4BJiZpSpXvmcGdMsj2OkHIfkKTS+jgCyzV2
JoD9gA7NdVHcGOuJkTjjyUPX5QO2sB1YPe7l+Zgk4pC0uj82TqxKQwiDs8CS1Oyo+UbJFkIuyrkn
9S6kK4mhzVnCVPkZsOheZTXRNajeIPILjBLDsAyJX89nIBkt5r87nons29ZZbLzdjrKOfDZezE7B
/xRg9T/oE9PMf1t/AgAA//8DAFBLAwQUAAYACAAAACEApdan58AAAAA2AQAACwAAAF9yZWxzLy5y
ZWxzhI/PasMwDIfvhb2D0X1R0sMYJXYvpZBDL6N9AOEof2giG9sb69tPxwYKuwiEpO/3qT3+rov5
4ZTnIBaaqgbD4kM/y2jhdj2/f4LJhaSnJQhbeHCGo3vbtV+8UNGjPM0xG6VItjCVEg+I2U+8Uq5C
ZNHJENJKRds0YiR/p5FxX9cfmJ4Z4DZM0/UWUtc3YK6PqMn/s8MwzJ5PwX+vLOVFBG43lExp5GKh
qC/jU72QqGWq1B7Qtbj51v0BAAD//wMAUEsDB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lTWFuYWdlci54bWwucmVsc1BLBQYAAAAABQAFAF0BAAAXCgAAAAA=

------=_NextPart_01D531BC.80714FE0
Content-Location: file:///C:/4071C90C/file8860.files/colorschememapping.xml
Content-Transfer-Encoding: quoted-printable
Content-Type: text/xml

<?xml version=3D"1.0" encoding=3D"UTF-8" standalone=3D"yes"?>
<a:clrMap xmlns:a=3D"http://schemas.openxmlformats.org/drawingml/2006/main"=
 bg1=3D"lt1" tx1=3D"dk1" bg2=3D"lt2" tx2=3D"dk2" accent1=3D"accent1" accent=
2=3D"accent2" accent3=3D"accent3" accent4=3D"accent4" accent5=3D"accent5" a=
ccent6=3D"accent6" hlink=3D"hlink" folHlink=3D"folHlink"/>
------=_NextPart_01D531BC.80714FE0
Content-Location: file:///C:/4071C90C/file8860.files/filelist.xml
Content-Transfer-Encoding: quoted-printable
Content-Type: text/xml; charset="utf-8"

<xml xmlns:o=3D"urn:schemas-microsoft-com:office:office">
 <o:MainFile HRef=3D"../file8860.htm"/>
 <o:File HRef=3D"item0001.xml"/>
 <o:File HRef=3D"props002.xml"/>
 <o:File HRef=3D"themedata.thmx"/>
 <o:File HRef=3D"colorschememapping.xml"/>
 <o:File HRef=3D"filelist.xml"/>
</xml>
------=_NextPart_01D531BC.80714FE0--

我的业务需求是需要循环表格,所以用<#list>标签包住<table>标签进行循环,具体使用按你的需求来。注意不要删除换行的"="。

模板目录如下:

springboot 导出下载excel报错时返回错误信息 springboot 导出word_ide_03

在配置类中配置工具类:

@Bean
    public HtmlBuilder htmlBuilder(FreeMarkerConfigurer freeMarkerConfigurer){
        return new HtmlBuilder(freeMarkerConfigurer);
    }

工具类代码:

public class HtmlBuilder {

    private static final Logger LOGGER = LoggerFactory.getLogger(HtmlBuilder.class);

    private ThreadLocal<Map<String, Object>> map = ThreadLocal.withInitial(HashMap::new);

    private FreeMarkerConfigurer freeMarkerConfigurer;

    public HtmlBuilder(FreeMarkerConfigurer freeMarkerConfigurer) {
        this.freeMarkerConfigurer = freeMarkerConfigurer;
    }

    /**
     * 生成html文件
     *
     * @param htmlFile     html文件
     * @param templateName 模板名
     */
    public File convertHtml(File htmlFile, String templateName) {
        FileOutputStream fos = null;
        OutputStreamWriter osw = null;
        BufferedWriter bw = null;
        try {
            Template template = freeMarkerConfigurer.getConfiguration().getTemplate(templateName);
            BeansWrapper myWrapper = new BeansWrapperBuilder(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS).build();
            template.setObjectWrapper(myWrapper);
            fos = new FileOutputStream(htmlFile);
            osw = new OutputStreamWriter(new FileOutputStream(htmlFile), "UTF-8");
            bw = new BufferedWriter(osw);
            template.process(getRootMap(), bw);
            getRootMap().clear();
        } catch (Exception e) {
            LOGGER.error("FREEMARKER - create html by template error with templateName : " + templateName, e);
        } finally {
            IOUtils.closeQuietly(fos);
            IOUtils.closeQuietly(osw);
            IOUtils.closeQuietly(bw);
        }
        return htmlFile;
    }

    /**
     * 生成html模板字符串
     *
     * @return 模板字符串
     */
    public String getHtmlText(String templateName) {
        String htmlText = "";
        try {
            // 通过指定模板名获取FreeMarker模板实例
            Configuration configuration = freeMarkerConfigurer.getConfiguration();
            configuration.setDefaultEncoding("utf-8");
            Template tpl = configuration.getTemplate(templateName, "utf-8");
            htmlText = FreeMarkerTemplateUtils.processTemplateIntoString(tpl, getRootMap());
            getRootMap().clear();
        } catch (Exception e) {
            LOGGER.error("FREEMARKER - create html by template error with templateName : " + templateName, e);
        }
        return htmlText;
    }

    private Map<String, Object> getRootMap() {
        return this.map.get();
    }

    public HtmlBuilder addRootMap(String key, Object value) {
        getRootMap().put(key, value);
        return this;
    }

    public HtmlBuilder addRootMaps(Map<String, Object> map) {
        getRootMap().putAll(map);
        return this;
    }

    public FreeMarkerConfigurer getFreeMarkerConfigurer() {
        return freeMarkerConfigurer;
    }

    public void setFreeMarkerConfigurer(FreeMarkerConfigurer freeMarkerConfigurer) {
        this.freeMarkerConfigurer = freeMarkerConfigurer;
    }

}

configuration.setDefaultEncoding(“utf-8”);
Template tpl = configuration.getTemplate(templateName, “utf-8”);

记得要设置字符集

service调用

@Override
    public void exportWord(List<String> relatedCodes, HttpServletRequest request, HttpServletResponse response) {
        ComparisonInfoSearchModel model = new ComparisonInfoSearchModel();
        model.setIndexType(Constants.ComparisonInfoIndexType.TENDER_EXTRACT)
                .setRelatedCodes(relatedCodes).setIsExportWord(BooleanValue.YES.ordinal());
        model.setPageSize(1000);
        List<Map<String, Object>> mapList = (List<Map<String, Object>>) esHandler.query(model).get("data");
        //这里是根据数据替换模板中的字段并返回一个字符串
        String html = getHtmlText(mapList);
        //对html中的中文进行Unicode编码,这里是最关键的一步,必须,不然导出的wordoffice打开乱码
       html = EncodingUtil.setUrlForChn(html);
        System.out.println(html);
        String encodedFileName = FileNameUtils.encodingFileName(
                request, "测试word"+LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))+".doc");
        InputStream inputStream = new ByteArrayInputStream(html.getBytes());
        FileDownloadUtil.download(inputStream, request, response, encodedFileName);
    }
    
    private String getHtmlText(List<Map<String, Object>> mapList){
            mapList.forEach(item -> {
                item.put("region", getLocation(String.valueOf(item.get("province_id")),
                        String.valueOf(item.get("city_id")), String.valueOf(item.get("county_id"))));
                item.put("content", HtmlUtils.delStyle(String.valueOf(item.get("content"))));
            });
            //数据存到map中
            htmlBuilder.addRootMap("dataList", mapList);
            /*
              FIXME comparisonInfo.mht 为微软office生成的模板,
              FIXME 需要注意的是WPS生成的模板(comparisonInfo1.mht)并不支持office
              FIXME comparisonInfo.ftl 不支持带有html标签的内容
             */
            return htmlBuilder.getHtmlText("comparisonInfo.mht");
        }

EncodingUtil代码

public class EncodingUtil {

    /**
     * 对含有中文字符的字符串进行Unicode编码(包括特殊字符)
     */
    public static String setUrlForChn(String url) {
        String regEx = "[^\\x00-\\xff]";
        Pattern p = Pattern.compile(regEx);
        Matcher m = p.matcher(url);
        StringBuffer sb = new StringBuffer();
        while(m.find()){
            String str = m.group();
            System.out.println(str);
            char[] chars = str.toCharArray();
            m.appendReplacement(sb, "&#" + String.valueOf((int)chars[0]) + ";");
        }
        m.appendTail(sb);
        return sb.toString();
    }
}

FileDownloadUtil代码:

public class FileDownloadUtil {

    private static final MediaType MS_DOWNLOAD = new MediaType("application", "x-msdownload");

    public static void download(InputStream inputStream, HttpServletRequest request, HttpServletResponse response,
                                String fileName){
        BufferedInputStream br = null;
        OutputStream out = null;
        try{
            boolean isIE = isIE(request);
            //必须
            response.setCharacterEncoding("utf-8");
            response.setContentType(isIE ? MS_DOWNLOAD.toString() : MediaType.APPLICATION_OCTET_STREAM.toString());
            response.addHeader("Content-Disposition", ContentDisposition.builder("attachment")
                    .filename(fileName)
                    .build().toString());
            br = new BufferedInputStream(inputStream);
            out = response.getOutputStream();
            int len;
            byte[] buf = new byte[1024];
            while ((len = br.read(buf)) > 0){
                out.write(buf, 0, len);
            }
        } catch (Exception e){
            e.printStackTrace();
        } finally {
            IOUtils.closeQuietly(br);
            IOUtils.closeQuietly(out);
        }
    }

    public static boolean isIE(HttpServletRequest request) {
        String[] IEBrowserSignals = {"MSIE", "Trident", "Edge"};
        String userAgent = request.getHeader("User-Agent");
        for (String signal : IEBrowserSignals) {
            if (userAgent.contains(signal)){
                return true;
            }
        }
        return false;
    }
}

下载下来的文件用nodepad打开:

springboot 导出下载excel报错时返回错误信息 springboot 导出word_ide_04


实际生成的还是mht格式的,文档中的中文转换成了html格式的unicode编码

生成效果:

springboot 导出下载excel报错时返回错误信息 springboot 导出word_word导出_05