#!/perl/bin/perl use warnings; use strict; use Win32::OLE; use Win32::OLE::Const; use Data::Dumper; Win32::OLE->Option(Warn => 2); my $wordConsts = Win32::OLE::Const->Load("Microsoft Word 11.0 Object Library"); # use existing instance if Word is already running my $server; eval {$server = Win32::OLE->GetActiveObject('Word.Application')}; die "Word not installed" if $@; unless (defined $server) { $server = Win32::OLE->new('Word.Application', sub {$_[0]->Quit;}) or die "Oops, cannot start Word"; } my $doc = $server->Documents->Open('D:\perlstuff\testDocument.doc'); # $doc->SaveAs('d:\testSave.txt', $wordConsts->{'wdFormatDOSText'}); parseProps($doc); sub parseProps { my %hash = %{$_[0]}; foreach my $key (sort(keys %hash)) { print("$key = "); if (!(UNIVERSAL::isa($hash{$key}, "HASH"))) { print("not a hash.\n"); } else { print("HASH ref\n"); parseProps($hash{$key}); } } } #### Compatibility PrintFractionalWidths Container ActiveWritingStyle HasMailer Mailer VBProject Frameset MailEnvelope DisableFeaturesIntroducedAfter Permission DocumentLibraryVersions Frameset International MacroContainer SynonymInfo VBE KeysBoundTo FindKey IsObjectValid FileDialog Compatibility