简体   繁体   English

导出到MS Word时保持CKEditor格式

[英]Keep CKEditor formatting when exporting to MS Word

I'm trying to export a text area (for which I use ckeditor) into a Word document. 我正在尝试将文本区域(为此使用ckeditor)导出到Word文档中。 I'm using JSP, and setting HTTP headers of a target page to receive the textarea value in request scope: 我正在使用JSP,并设置目标页面的HTTP标头以在请求范围内接收textarea值:

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

However, I lose formatting and style of my source ckeditor (example below) when the Word document has been generated: 但是,生成Word文档时,我的源ckeditor的格式和样式(以下示例)丢失了:

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

Is there any way to keep the formatting, either by generating the Word document or through CKEditor? 是否可以通过生成Word文档或通过CKEditor来保持格式?

Using googoose.js or html-doc.js solved my problem. 使用googoose.js或html-doc.js解决了我的问题。 An open xml library should have been used to process html tags for the ms-word output. 应该使用一个开放的xml库来处理ms-word输出的html标签。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从数据库检索数据时,如何编辑xsl以保持格式? - How to edit xsl to keep formatting, when retrieving data from database? 在IntelliJ中自动格式化Java代码时保留空格 - Keep whitespaces when auto-formatting Java code in IntelliJ 在使用JAK kml库进行编组时如何保持字符串格式 - How to keep string formatting when marshalling with JAK kml library 在Eclipse中格式化紧凑的if-else语句时请保持括号 - Keep braces when formatting compact if-else statements in Eclipse 如何在使用 Apache poi 导出到 excel 时设置格式样式时跳过某些列? - How to skip certain columns when setting formatting style while exporting to excel using Apache poi? MS Word 2004(OSX)冻结或显示对话框时如何处理? - How to deal when MS Word 2004 (OSX) is freezing or displaying dialogs? 当从 Java 写入时,为什么 MS Word 中的括号(方括号)会倒转? - why are parentheses (brackets) inverted in MS Word when written to from Java? 在 aspose word 中使用 FieldMergingCallback 时,MS Word 邮件合并字段格式丢失 - MS Word Mail Merge field format lost when using FieldMergingCallback in aspose word 格式化数字以将逗号导出到Excel - Formatting number to have commas in exporting to excel 使单词解析HTML格式 - Making word parse HTML formatting
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM