If you have Word installed, you can utilize Win32::OLE to make Word convert it for you.
use strict;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Word';
use File::Spec;
my ($input_html,$output_doc) = @ARGV;
my $word = Win32::OLE->CreateObject('Word.Application');
$word->{'Visible'} = 0;
my $file = $word->Documents->Open({
FileName => File::Spec->rel2abs($input_html),
Format => wdOpenFormatWebPages,
ConfirmConversions => 0,
AddToRecentFiles => 0,
Revert => 0,
ReadOnly => 1,
OpenAndRepair => 0,
}) or die dump $word;
# Save As
$word->ActiveDocument->SaveAs({
FileName => File::Spec->rel2abs($output_doc),
FileFormat => wdFormatDocument,
});
# Quit/Close
$file->Close({SaveChanges => wdDoNotSaveChanges});
$word->Quit( {SaveChanges => wdDoNotSaveChanges});
Of course Word's sense of HTML is somewhat limited, but mostly that works quite well.
-- Roman |