[英]Using “msoEncodingUTF8” with Win32::OLE in a perl script
I'm having a Perl script which saves a Word document as a HTML one. 我有一个Perl脚本,该脚本将Word文档另存为HTML。 The following code works: 以下代码有效:
use strict;
use Win32::OLE::Const 'Microsoft Word';
[...]
$go_word_doc->SaveAs2({
FileName => $gs_html_name,
FileFormat => wdFormatFilteredHTML
});
In order to encode the output file in UTF-8, I turned my command in this way: 为了用UTF-8编码输出文件,我以这种方式打开了命令:
$go_word_doc->SaveAs2({
FileName => $gs_html_name,
FileFormat => wdFormatFilteredHTML,
Encoding => msoEncodingUTF8
});
The problem is that "msoEncodingUTF8" is seen as a bareword, and I can't find anywhere what I'm supposed to add for it to work. 问题是“ msoEncodingUTF8”被看作是一个简单的单词,我在任何地方都找不到应该添加的内容才能正常工作。
Could anyone help, please? 有人可以帮忙吗? Thanks in advance. 提前致谢。
The MsoEncoding
Enum gives names to the Windows code pages. MsoEncoding
枚举为Windows代码页提供名称。 msoEncodingUTF8
is the name given to the UTF-8 code page, 65001
. msoEncodingUTF8
是给UTF-8代码页指定的名称65001
。
use constant msoEncodingUTF8 => 65001;
以下命令将为您创建msoEncodingUTF8
(和其他常量):
use Win32::OLE::Const 'Microsoft Office [0-9.]+ Object Library';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.