简体   繁体   English

清理从 MS Word 粘贴的内容

[英]cleaning up content pasted from MS Word

I'm looking for a server-side (C#) approach to cleaning up content pasted from MS Word.我正在寻找一种服务器端 (C#) 方法来清理从 MS Word 粘贴的内容。 I know that a lot of the Rich Text Editors like FCKEdit have this ability built in, but I'd like to handle it on the backend to make it as seamless as possible to the user.我知道很多像 FCKEdit 这样的富文本编辑器都内置了这种功能,但我想在后端处理它,以使其对用户尽可能无缝。

Jeff posted an approach to doing this杰夫发布了一种方法来做到这一点

http://www.codinghorror.com/blog/archives/000485.html http://www.codinghorror.com/blog/archives/000485.html

but that's over three years old.但那已经是三年多了。 Are there any better approaches to doing this?有没有更好的方法来做到这一点?

Having had to deal with similar things in the past (and generally stuck with the editor's built in options), I'd say that Jeff's regex collection looks about right - I've not tested it, but it seems to cover most of the weird markup (all the <o:p> type tags for example) that word adds.过去不得不处理类似的事情(并且通常坚持使用编辑器的内置选项),我会说 Jeff 的正则表达式集合看起来不错 - 我没有测试过它,但它似乎涵盖了大部分奇怪的东西该词添加的标记(例如所有 <o:p> 类型的标签)。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM