jsp导出到word,默认显示为web视图,应该该为页面视图

将word另存为html文件,加入jstl标签导出时,打开默认为web版式视图,如下


jsp导出到word,默认显示为web视图,应该该为页面视图_第1张图片

如上图可视,显示效果特别差,如果我们想将其改为常用的页面视图,只需将下面的代码段替换到模板jsp中即可

<strong><span style="font-size:18px;"><span style="font-size:18px;"><html xmlns:w="urn:schemas-microsoft-com:office:word">
<head>
<!--[if gte mso 9]>
  <xml>
    <w:WordDocument>
      <w:View>Print</w:View>
      <w:DoNotOptimizeForBrowser/>
      <w:Compatibility>
        <w:DontGrowAutofit/>
      </w:Compatibility>
    </w:WordDocument>
  </xml>
<![endif]-->
<style type="text/css">
  <%= global_style %>
  <%= report_style %>
</style>
</head>
<body>
<div id="word-export" class="WordSection1">
</span></span></strong>

替换后的:


jsp导出到word,默认显示为web视图,应该该为页面视图_第2张图片

你可能感兴趣的:(jsp,页面视图,导出到word)