读书人

Ruby操作word时遇到中文有关问题

发布时间: 2012-12-25 16:18:29 作者: rapoo

Ruby操作word时遇到中文问题

# coding: utf-8

require "win32ole"

?

word=WIN32OLE.new('word.Application')

word.visible=true

doc=word.Documents

doc.add

?

s=word.Selection

?

s.TypeText('Text'=>'唇形')

?

#doc.save

?

?

#文件头要加上 ?# coding: utf-8

#文件以utf-8 保存

读书人网 >Ruby Rails

热点推荐