我有一个脚本,VBS 或 Ruby,将 Word 文档保存为“过滤的 HTML”,但编码参数被忽略。HTML 文件始终以 Windows-1252 编码。我在 Windows 7 SP1 上使用 Word 2007 SP3。
红宝石示例:
require 'win32ole'
word = WIN32OLE.new('Word.Application')
word.visible = false
word_document = word.documents.open('C:\whatever.doc')
word_document.saveas({'FileName' => 'C:\whatever.html', 'FileFormat' => 10, 'Encoding' => 65001})
word_document.close()
word.quit
VBS 示例:
Option Explicit
Dim MyWord
Dim MyDoc
Set MyWord = CreateObject("Word.Application")
MyWord.Visible = False
Set MyDoc = MyWord.Documents.Open("C:\whatever.doc")
MyDoc.SaveAs "C:\whatever2.html", 10, , , , , , , , , , 65001
MyDoc.Close
MyWord.Quit
Set MyDoc = Nothing
Set MyWord = Nothing
文档:
Document.SaveAs:http: //msdn.microsoft.com/en-us/library/bb221597.aspx
msoEncoding 值: http: //msdn.microsoft.com/en-us/library/office/aa432511 (v=office.12).aspx
任何建议,如何让 Word 以 UTF-8 保存 HTML 文件?