Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
RuoYi-Vue-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
融通安全管理系统
RuoYi-Vue-master
Commits
2b915223
Commit
2b915223
authored
Jul 24, 2023
by
周昊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、修改pc端导出风险告知卡图片
parent
1e2af8dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
124 additions
and
80 deletions
+124
-80
ruoyi-admin/src/main/resources/templates/ftl/word.ftl
ruoyi-admin/src/main/resources/templates/ftl/word.ftl
+103
-54
ruoyi-common/src/main/java/com/ruoyi/common/utils/WordUtil.java
...common/src/main/java/com/ruoyi/common/utils/WordUtil.java
+21
-26
No files found.
ruoyi-admin/src/main/resources/templates/ftl/word.ftl
View file @
2b915223
...
...
@@ -30,9 +30,9 @@
<o:Author>
x066563
</o:Author>
<o:LastAuthor>
x066563
</o:LastAuthor>
<o:Revision>
2
</o:Revision>
<o:TotalTime>
1
</o:TotalTime>
<o:Created>
2023-07-24T
09:59
:00Z
</o:Created>
<o:LastSaved>
2023-07-24T
09:59
:00Z
</o:LastSaved>
<o:TotalTime>
0
</o:TotalTime>
<o:Created>
2023-07-24T
12:44
:00Z
</o:Created>
<o:LastSaved>
2023-07-24T
12:44
:00Z
</o:LastSaved>
<o:Pages>
1
</o:Pages>
<o:Words>
24
</o:Words>
<o:Characters>
138
</o:Characters>
...
...
@@ -411,11 +411,22 @@
<w:tblPr>
<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: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:tblPr>
</w:style>
...
...
@@ -425,7 +436,8 @@
<w:bodyDiv
w:val=
"on"
/>
<w:marLeft
w:val=
"0"
/>
<w:marRight
w:val=
"0"
/>
<w:marTop
w:val=
"0"
/>
<w:marTop
w:val=
"0"
/>
<w:marBottom
w:val=
"0"
/>
<w:divBdr>
<w:top
w:val=
"none"
w:sz=
"0"
wx:bdrwidth=
"0"
w:space=
"0"
w:color=
"auto"
/>
...
...
@@ -479,14 +491,14 @@
</w:hdrShapeDefaults>
<w:footnotePr>
<w:footnote
w:type=
"separator"
>
<w:p
wsp:rsidR=
"00
4416E4"
wsp:rsidRDefault=
"004416E4
"
wsp:rsidP=
"00A83D26"
>
<w:p
wsp:rsidR=
"00
A30366"
wsp:rsidRDefault=
"00A30366
"
wsp:rsidP=
"00A83D26"
>
<w:r>
<w:separator/>
</w:r>
</w:p>
</w:footnote>
<w:footnote
w:type=
"continuation-separator"
>
<w:p
wsp:rsidR=
"00
4416E4"
wsp:rsidRDefault=
"004416E4
"
wsp:rsidP=
"00A83D26"
>
<w:p
wsp:rsidR=
"00
A30366"
wsp:rsidRDefault=
"00A30366
"
wsp:rsidP=
"00A83D26"
>
<w:r>
<w:continuationSeparator/>
</w:r>
...
...
@@ -495,14 +507,14 @@
</w:footnotePr>
<w:endnotePr>
<w:endnote
w:type=
"separator"
>
<w:p
wsp:rsidR=
"00
4416E4"
wsp:rsidRDefault=
"004416E4
"
wsp:rsidP=
"00A83D26"
>
<w:p
wsp:rsidR=
"00
A30366"
wsp:rsidRDefault=
"00A30366
"
wsp:rsidP=
"00A83D26"
>
<w:r>
<w:separator/>
</w:r>
</w:p>
</w:endnote>
<w:endnote
w:type=
"continuation-separator"
>
<w:p
wsp:rsidR=
"00
4416E4"
wsp:rsidRDefault=
"004416E4
"
wsp:rsidP=
"00A83D26"
>
<w:p
wsp:rsidR=
"00
A30366"
wsp:rsidRDefault=
"00A30366
"
wsp:rsidP=
"00A83D26"
>
<w:r>
<w:continuationSeparator/>
</w:r>
...
...
@@ -525,23 +537,25 @@
</w:compat>
<wsp:rsids>
<wsp:rsidRoot
wsp:val=
"002F6507"
/>
<wsp:rsid
wsp:val=
"000B0B97"
/>
<wsp:rsid
wsp:val=
"00105C8A"
/>
<wsp:rsid
wsp:val=
"001A0099"
/>
<wsp:rsid
wsp:val=
"001F3F72"
/>
<wsp:rsid
wsp:val=
"002005D9"
/>
<wsp:rsid
wsp:val=
"002F6507"
/>
<wsp:rsid
wsp:val=
"004416E4"
/>
<wsp:rsid
wsp:val=
"004A7FC2"
/>
<wsp:rsid
wsp:val=
"004B508D"
/>
<wsp:rsid
wsp:val=
"004E41AD"
/>
<wsp:rsid
wsp:val=
"00566CAE"
/>
<wsp:rsid
wsp:val=
"006F07FB"
/>
<wsp:rsid
wsp:val=
"006F7739"
/>
<wsp:rsid
wsp:val=
"00877F9D"
/>
<wsp:rsid
wsp:val=
"008D591E"
/>
<wsp:rsid
wsp:val=
"00935467"
/>
<wsp:rsid
wsp:val=
"009370A0"
/>
<wsp:rsid
wsp:val=
"009A59FC"
/>
<wsp:rsid
wsp:val=
"009B622A"
/>
<wsp:rsid
wsp:val=
"00A30366"
/>
<wsp:rsid
wsp:val=
"00A35DA6"
/>
<wsp:rsid
wsp:val=
"00A83D26"
/>
<wsp:rsid
wsp:val=
"00D91E3B"
/>
<wsp:rsid
wsp:val=
"00E01588"
/>
...
...
@@ -555,12 +569,14 @@
<w:p
wsp:rsidR=
"004E41AD"
wsp:rsidRDefault=
"00A83D26"
wsp:rsidP=
"009A59FC"
>
<w:pPr>
<w:pStyle
w:val=
"1"
/>
<w:jc
w:val=
"center"
/>
<w:jc
w:val=
"center"
/>
</w:pPr>
<w:r
wsp:rsidRPr=
"00A83D26"
>
<w:rPr>
<w:rFonts
w:hint=
"fareast"
/>
<wx:font
wx:val=
"宋体"
/>
<wx:font
wx:val=
"宋体"
/>
</w:rPr>
<w:t>
安全风险告知卡
</w:t>
</w:r>
...
...
@@ -576,7 +592,8 @@
<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:tblLook
w:val=
"04A0"
/>
<w:tblLook
w:val=
"04A0"
/>
</w:tblPr>
<w:tblGrid>
<w:gridCol
w:w=
"817"
/>
...
...
@@ -587,10 +604,13 @@
<w:tc>
<w:tcPr>
<w:tcW
w:w=
"1951"
w:type=
"dxa"
/>
<w:gridSpan
w:val=
"2"
/>
<w:gridSpan
w:val=
"2"
/>
<w:shd
w:val=
"clear"
w:color=
"auto"
w:fill=
"00B0F0"
/>
</w:tcPr>
<w:p
wsp:rsidR=
"00A83D26"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"00A83D26"
<w:p
wsp:rsidR=
"00A83D26"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"00A83D26"
wsp:rsidP=
"009370A0"
>
<w:pPr>
<w:jc
w:val=
"center"
/>
...
...
@@ -628,10 +648,13 @@
<w:tc>
<w:tcPr>
<w:tcW
w:w=
"1951"
w:type=
"dxa"
/>
<w:gridSpan
w:val=
"2"
/>
<w:gridSpan
w:val=
"2"
/>
<w:shd
w:val=
"clear"
w:color=
"auto"
w:fill=
"auto"
/>
</w:tcPr>
<w:p
wsp:rsidR=
"009A59FC"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"00566CAE"
<w:p
wsp:rsidR=
"009A59FC"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"00566CAE"
wsp:rsidP=
"009370A0"
>
<w:pPr>
<w:jc
w:val=
"center"
/>
...
...
@@ -640,7 +663,7 @@
<w:rPr>
<wx:font
wx:val=
"宋体"
/>
</w:rPr>
<w:t>
${name}
</w:t>
<w:t>
插座电线老化裸露
</w:t>
</w:r>
<w:r
wsp:rsidRPr=
"009370A0"
>
<w:t>
(
</w:t>
...
...
@@ -649,7 +672,7 @@
<w:rPr>
<wx:font
wx:val=
"宋体"
/>
</w:rPr>
<w:t>
${level}
</w:t>
<w:t>
较小风险
</w:t>
</w:r>
<w:r
wsp:rsidRPr=
"009370A0"
>
<w:t>
)
</w:t>
...
...
@@ -670,7 +693,7 @@
<w:rPr>
<wx:font
wx:val=
"宋体"
/>
</w:rPr>
<w:t>
${dangerName}
</w:t>
<w:t>
插线板
</w:t>
</w:r>
</w:p>
</w:tc>
...
...
@@ -679,10 +702,13 @@
<w:tc>
<w:tcPr>
<w:tcW
w:w=
"1951"
w:type=
"dxa"
/>
<w:gridSpan
w:val=
"2"
/>
<w:gridSpan
w:val=
"2"
/>
<w:shd
w:val=
"clear"
w:color=
"auto"
w:fill=
"00B0F0"
/>
</w:tcPr>
<w:p
wsp:rsidR=
"009A59FC"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"009A59FC"
<w:p
wsp:rsidR=
"009A59FC"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"009A59FC"
wsp:rsidP=
"009370A0"
>
<w:pPr>
<w:jc
w:val=
"center"
/>
...
...
@@ -720,10 +746,13 @@
<w:tc>
<w:tcPr>
<w:tcW
w:w=
"1951"
w:type=
"dxa"
/>
<w:gridSpan
w:val=
"2"
/>
<w:gridSpan
w:val=
"2"
/>
<w:shd
w:val=
"clear"
w:color=
"auto"
w:fill=
"auto"
/>
</w:tcPr>
<w:p
wsp:rsidR=
"009A59FC"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"00566CAE"
<w:p
wsp:rsidR=
"009A59FC"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"00566CAE"
wsp:rsidP=
"009370A0"
>
<w:pPr>
<w:jc
w:val=
"center"
/>
...
...
@@ -732,7 +761,7 @@
<w:rPr>
<wx:font
wx:val=
"宋体"
/>
</w:rPr>
<w:t>
${pointType}
</w:t>
<w:t>
设备设施类
</w:t>
</w:r>
</w:p>
</w:tc>
...
...
@@ -750,7 +779,7 @@
<w:rPr>
<wx:font
wx:val=
"宋体"
/>
</w:rPr>
<w:t>
${type}
</w:t>
<w:t>
触电
</w:t>
</w:r>
</w:p>
</w:tc>
...
...
@@ -759,10 +788,13 @@
<w:tc>
<w:tcPr>
<w:tcW
w:w=
"1951"
w:type=
"dxa"
/>
<w:gridSpan
w:val=
"2"
/>
<w:gridSpan
w:val=
"2"
/>
<w:shd
w:val=
"clear"
w:color=
"auto"
w:fill=
"00B0F0"
/>
</w:tcPr>
<w:p
wsp:rsidR=
"009A59FC"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"009A59FC"
<w:p
wsp:rsidR=
"009A59FC"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"009A59FC"
wsp:rsidP=
"009370A0"
>
<w:pPr>
<w:jc
w:val=
"center"
/>
...
...
@@ -800,23 +832,28 @@
<w:tc>
<w:tcPr>
<w:tcW
w:w=
"1951"
w:type=
"dxa"
/>
<w:gridSpan
w:val=
"2"
/>
<w:gridSpan
w:val=
"2"
/>
<w:shd
w:val=
"clear"
w:color=
"auto"
w:fill=
"auto"
/>
</w:tcPr>
<w:p
wsp:rsidR=
"00566CAE"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"00877F9D"
<w:p
wsp:rsidR=
"00566CAE"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"000B0B97"
wsp:rsidP=
"009370A0"
>
<w:pPr>
<w:jc
w:val=
"center"
/>
</w:pPr>
<w:r
wsp:rsidRPr=
"00
877F9D
"
>
<w:r
wsp:rsidRPr=
"00
0B0B97
"
>
<w:rPr>
<w:rFonts
w:ascii=
"Helvetica"
w:h-ansi=
"Helvetica"
w:cs=
"Helvetica"
/>
<wx:font
wx:val=
"Helvetica"
/>
<wx:font
wx:val=
"Helvetica"
/>
<w:noProof/>
<w:color
w:val=
"333333"
/>
<w:kern
w:val=
"0"
/>
<w:sz
w:val=
"30"
/>
<w:sz-cs
w:val=
"30"
/>
<w:sz-cs
w:val=
"30"
/>
</w:rPr>
<w:pict>
<v:shapetype
id=
"_x0000_t75"
coordsize=
"21600,21600"
o:spt=
"75"
...
...
@@ -837,12 +874,14 @@
<v:f
eqn=
"prod @7 21600 pixelHeight"
/>
<v:f
eqn=
"sum @10 21600 0"
/>
</v:formulas>
<v:path
o:extrusionok=
"f"
gradientshapeok=
"t"
o:connecttype=
"rect"
/>
<o:lock
v:ext=
"edit"
aspectratio=
"t"
/>
<v:path
o:extrusionok=
"f"
gradientshapeok=
"t"
o:connecttype=
"rect"
/>
<o:lock
v:ext=
"edit"
aspectratio=
"t"
/>
</v:shapetype>
<w:binData
w:name=
"wordml://03000001.png"
xml:space=
"preserve"
>
${safetyWarningSigns}
</w:binData>
<v:shape
id=
"图片 1"
o:spid=
"_x0000_i102
7
"
type=
"#_x0000_t75"
style=
"width:66.
75pt;height:58.5
pt;visibility:visible;mso-wrap-style:square"
>
<v:shape
id=
"图片 1"
o:spid=
"_x0000_i102
5
"
type=
"#_x0000_t75"
style=
"width:66.
6pt;height:58.8
pt;visibility:visible;mso-wrap-style:square"
>
<v:imagedata
src=
"wordml://03000001.png"
o:title=
""
cropleft=
"2313f"
cropright=
"1808f"
/>
</v:shape>
...
...
@@ -864,7 +903,7 @@
<w:rPr>
<wx:font
wx:val=
"宋体"
/>
</w:rPr>
<w:t>
${measuresAdministration}
</w:t>
<w:t>
在容易发生隐患的地点张贴提示标识。
</w:t>
</w:r>
</w:p>
</w:tc>
...
...
@@ -873,9 +912,11 @@
<w:tc>
<w:tcPr>
<w:tcW
w:w=
"817"
w:type=
"dxa"
/>
<w:shd
w:val=
"clear"
w:color=
"auto"
w:fill=
"00B0F0"
/>
<w:shd
w:val=
"clear"
w:color=
"auto"
w:fill=
"00B0F0"
/>
</w:tcPr>
<w:p
wsp:rsidR=
"009A59FC"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"009A59FC"
<w:p
wsp:rsidR=
"009A59FC"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"009A59FC"
wsp:rsidP=
"009370A0"
>
<w:pPr>
<w:jc
w:val=
"center"
/>
...
...
@@ -932,15 +973,17 @@
<w:tc>
<w:tcPr>
<w:tcW
w:w=
"817"
w:type=
"dxa"
/>
<w:shd
w:val=
"clear"
w:color=
"auto"
w:fill=
"auto"
/>
<w:shd
w:val=
"clear"
w:color=
"auto"
w:fill=
"auto"
/>
</w:tcPr>
<w:p
wsp:rsidR=
"009A59FC"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"006F07FB"
<w:p
wsp:rsidR=
"009A59FC"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"006F07FB"
wsp:rsidP=
"009370A0"
>
<w:pPr>
<w:jc
w:val=
"center"
/>
</w:pPr>
<w:r
wsp:rsidRPr=
"009370A0"
>
<w:t>
${deptName}
</w:t>
<w:t>
0
</w:t>
</w:r>
</w:p>
</w:tc>
...
...
@@ -955,7 +998,7 @@
<w:jc
w:val=
"center"
/>
</w:pPr>
<w:r
wsp:rsidRPr=
"009370A0"
>
<w:t>
${userName}
</w:t>
<w:t>
123
</w:t>
</w:r>
</w:p>
</w:tc>
...
...
@@ -973,7 +1016,7 @@
<w:rPr>
<wx:font
wx:val=
"宋体"
/>
</w:rPr>
<w:t>
${measuresEmergency}
</w:t>
<w:t>
紧急关闭电源
</w:t>
</w:r>
</w:p>
</w:tc>
...
...
@@ -982,10 +1025,13 @@
<w:tc>
<w:tcPr>
<w:tcW
w:w=
"8522"
w:type=
"dxa"
/>
<w:gridSpan
w:val=
"3"
/>
<w:gridSpan
w:val=
"3"
/>
<w:shd
w:val=
"clear"
w:color=
"auto"
w:fill=
"FF0000"
/>
</w:tcPr>
<w:p
wsp:rsidR=
"009A59FC"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"009A59FC"
<w:p
wsp:rsidR=
"009A59FC"
wsp:rsidRPr=
"009370A0"
wsp:rsidRDefault=
"009A59FC"
wsp:rsidP=
"009370A0"
>
<w:pPr>
<w:jc
w:val=
"left"
/>
...
...
@@ -1017,13 +1063,16 @@
</w:tc>
</w:tr>
</w:tbl>
<w:p
wsp:rsidR=
"00A83D26"
wsp:rsidRPr=
"00A83D26"
wsp:rsidRDefault=
"00A83D26"
wsp:rsidP=
"009A59FC"
>
<w:p
wsp:rsidR=
"00A83D26"
wsp:rsidRPr=
"00A83D26"
wsp:rsidRDefault=
"00A83D26"
wsp:rsidP=
"009A59FC"
>
<w:pPr>
<w:jc
w:val=
"center"
/>
</w:pPr>
</w:p>
</wx:sub-section>
<w:sectPr
wsp:rsidR=
"00A83D26"
wsp:rsidRPr=
"00A83D26"
wsp:rsidSect=
"001A0099"
>
<w:sectPr
wsp:rsidR=
"00A83D26"
wsp:rsidRPr=
"00A83D26"
wsp:rsidSect=
"001A0099"
>
<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"
/>
...
...
ruoyi-common/src/main/java/com/ruoyi/common/utils/WordUtil.java
View file @
2b915223
...
...
@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
sun.misc.BASE64Encoder
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
...
...
@@ -91,33 +92,27 @@ public class WordUtil {
* @throws IOException
*/
public
static
void
responseDownloadFile
(
HttpServletRequest
request
,
HttpServletResponse
response
,
String
filePath
,
String
fileName
)
throws
IOException
{
// 读到流中
InputStream
inStream
=
new
FileInputStream
(
filePath
+
fileName
);
String
agent
=
request
.
getHeader
(
"User-Agent"
).
toUpperCase
();
String
encodedfileName
=
""
;
// IE
if
(
agent
.
indexOf
(
"MSIE"
)
!=
-
1
||
agent
.
indexOf
(
"TRIDENT"
)
!=
-
1
)
{
encodedfileName
=
URLEncoder
.
encode
(
fileName
,
"utf-8"
);
// 谷歌或火狐
}
else
if
(
agent
.
indexOf
(
"CHROME"
)
!=
-
1
||
agent
.
indexOf
(
"FIREFOX"
)
!=
-
1
)
{
encodedfileName
=
new
String
(
fileName
.
getBytes
(
"utf-8"
),
"ISO8859-1"
);
}
else
{
encodedfileName
=
new
String
(
fileName
.
getBytes
(
"utf-8"
),
"ISO8859-1"
);
}
// 设置输出的格式
response
.
reset
();
response
.
setContentType
(
"bin"
);
response
.
addHeader
(
"Content-Disposition"
,
"attachment; filename=\""
+
encodedfileName
+
"\""
);
// 循环取出流中的数据
byte
[]
b
=
new
byte
[
100
];
int
len
;
while
((
len
=
inStream
.
read
(
b
))
>
0
)
{
response
.
getOutputStream
().
write
(
b
,
0
,
len
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setContentType
(
"application/msword"
);
// 设置浏览器以下载的方式处理该文件名
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
.
concat
(
String
.
valueOf
(
URLEncoder
.
encode
(
fileName
,
"UTF-8"
))));
File
file
=
new
File
(
filePath
+
"/"
+
fileName
);
try
(
InputStream
fin
=
new
FileInputStream
(
file
);
ServletOutputStream
out
=
response
.
getOutputStream
())
{
// 缓冲区
byte
[]
buffer
=
new
byte
[
512
];
int
bytesToRead
;
// 通过循环将读入的Word文件的内容输出到浏览器中
while
((
bytesToRead
=
fin
.
read
(
buffer
))
!=
-
1
)
{
out
.
write
(
buffer
,
0
,
bytesToRead
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
// 删除临时文件
file
.
delete
();
}
inStream
.
close
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment