I'm having a Perl script which saves a Word document as a HTML one. 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:
$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.
Could anyone help, please? Thanks in advance.
The MsoEncoding
Enum gives names to the Windows code pages. msoEncodingUTF8
is the name given to the UTF-8 code page, 65001
.
use constant msoEncodingUTF8 => 65001;
以下命令将为您创建msoEncodingUTF8
(和其他常量):
use Win32::OLE::Const 'Microsoft Office [0-9.]+ Object Library';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.