关于jsp页面导出成word文档,后台获取的数据不换行问题

如题,我讲一个jsp页面导出成word文档,采用<%@ page language="java" contentType= "application/vnd.ms-word; charset=UTF-8" %>的方法,页面中有从后台获取的数据放在table里,我设定了table的宽度,但是导出之后依旧不换行

jsp代码:
<%@ page language="java" contentType= "application/vnd.ms-word; charset=UTF-8" %>
<%@ page pageEncoding= "UTF-8" %>
<%@ include file="/commons/global1.jsp"%>
<%@ include file="/commons/basejs1.jsp"%>

<%

String name = (String)request.getAttribute("hospital_name");
String fileName = name + "调研报告.doc" ;

  //对中文文件名编码 

//fileName = URLEncoder.encode(fileName, "utf-8");

byte[] yte = fileName.getBytes( "GB2312" ); 

        String unicoStr = new String(yte, "ISO-8859-1" );

     response.setHeader( "Content-disposition", "attachment; filename=" + unicoStr); 

%>

$(document).ready(function(){ changeSize(); }); $(window).resize(function(){ changeSize(); }); function changeSize(){ var marginLeft = ($('.repotrbody').width()-850)/2; console.log(marginLeft) $('.ulss').css({'margin-left':marginLeft+'px'}); }

  • ${hospital.hospital_name }
        通过我们的调研,我们发现${reportTotal.problem}
        现将具体调研情况汇报如下:
  •     一、系统上线后可优化的业务流程如下:
    ${reportTotal.flow}
</div>


你导出的是html不是word文档,你有两个办法,一个是替换换行符号为br标签
一个是用poi去生成真正的word文档