代码之家  ›  专栏  ›  技术社区  ›  Babybug

导出到MS Word时保留CKEditor格式

  •  0
  • Babybug  · 技术社区  · 7 年前

    我正在尝试将文本区域(我使用ckeditor)导出到Word文档中。我正在使用JSP,并将目标页面的HTTP标头设置为在请求范围内接收textarea值:

    <%@page contentType="application/vnd.ms-word"%>
    response.setHeader("Content-Disposition", "attachment;filename=responseLetter.doc")
    ...
    <%=textAreaReqScopeValue%>
    

    但是,在生成Word文档时,我会丢失源ckeditor(以下示例)的格式和样式:

    <p>Dear Anonymous,</p><p>This is in response to your <strong><em><u>request regarding your continued ...
    

    有没有办法通过生成Word文档或通过CKEditor来保持格式?

    1 回复  |  直到 7 年前
        1
  •  0
  •   Babybug    7 年前

    使用googoose。js或html文档。js解决了我的问题。应该使用开放的xml库来处理ms word输出的html标记。