My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
Word2Html  
word与html格式的相互转换研究
Updated Feb 4, 2010 by dragon...@gmail.com

概述

Ms word与html格式的相互转换研究

= word 2003以及更高版本中 ==

Microsoft HTML-filter 2.1 and Word 2003

The MS Office 2000 HTML Filter add-in's 'File=>Save as Compact HTML, isn't required in Word 2003. That functionallity is built in under File=>Save As=>Web Page-Filtered. The filtered choice uses the settings in Tools=>Options=>General=>Web Options to determine how it filters the documents more reliably than the add-in did. (The add-in sometimes needed you to restart Word for the settings to change, but it wasn't easy to see that, you 'just had to know' .

The standalone MSFilter.exe/MSFilter.DLL from the MS Office 2000 HTML filter (Start=>Programs=>Microsoft Office Tools) will still work independently for processing Word 2003 'regular' HTML files in batches to 'filtered' HTML files.

word 2000以及更早版本中

word可以直接另存为 htm,但即使是 另存为 html 也会有大量的废代码。以前我一般用 dreamweaver 的 clean up html 来处理,先处理 word 特有标签,然后删除一些 font,b,span 等。进一步,在 editplus 里面用正则进行处理,最后得到我想要的干净的html 代码。当然最完美的办法就是拷贝文字出来,自己用文本编辑器书写htm标签,:)

今天又看到lifehacker这几种word 2 clean htm方法:

  • 4.有人给出了正则表达式(其实,上面的各种软件也都是用正则来解决的)
  • 删除不需要的标签
    
    <[/]?(font|span|xml|[ovwxp]:w+)[^>]*?>
    - replace any matches with the empty string
    
    删除class,style...等不需要的属性
    
    <([^>]*)(?:class|lang|style|size|face|[ovwxp]:w+)=(?:'[^']*'|""[^""]*""|[^>]+)([^>]*)>
    - replace any matches with <$1$2>

详细解释在Clean Word HTML using Regular Expressions 把Word转为简洁的html的若干种方法

Word 文档转换器

WordML文档转换器研究

Html Agility Pack |.NET Html Agility Pack: How to use malformed HTML just like it was well-formed XML

HTML2Word |在VB中实现将HTM文件转换为DOC文件 |Save Word file to "filtered" HTML

Developing Word XML Using the Microsoft Office Word 2003 XML Toolbox

Powered by Google Project Hosting