Re: Microsoft Works
by tachyon (Chancellor) on Oct 06, 2004 at 02:05 UTC
|
As sgifford says the easy way is just to use OLE to automate MS Word. You will need M$ Word installed for this to work of course. All we do is open the works doc in
Word, then save it as wdFormatDocument. This example will convert all *.wps Works docs in the specified directory.
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Word';
my $dir = "C:";
my $ext = "wps";
my @files = map{ s!/!\\!g; $_ } grep{ m/\.($ext)/ } glob( "$dir/*" );
# check if Word exists and is running
my $word = Win32::OLE->GetActiveObject('Word.Application');
die "Word not Installed" if $@;
# start Word program instance if required or die if unable to
unless (defined $word) {
$word = Win32::OLE->new('Word.Application', sub { $_[0]->Quit; } )
+
or die 'Cannot start Word';
}
$word->{Visible} = 0; # set to 1 to watch
for my $infile( @files ) {
my $doc = $word->{Documents}->Open($infile) or
die "Can't open $infile, Reason:$Win32::OLE::LastError";
(my $outfile = $infile ) =~ s/\.\w+$/.doc/; # change file extensi
+on to .doc
$doc->SaveAs( { FileName => $outfile, FileFormat => wdFormatDocume
+nt } );
$doc->Close;
undef $doc;
}
$word->Close;
undef $word;
| [reply] [d/l] |
|
The problem with this is that Word fscks the foot notes from Works, and being that these are all philosophical texts with many footnotes, it is pointless to loose these. It seems I'll have to find something of a spec of the actual format of Works to proceed with this...
-- sae
| [reply] |
Re: Microsoft Works
by punch_card_don (Curate) on Oct 05, 2004 at 23:09 UTC
|
What about this:
http://www.microsoft.com/downloads/details.aspx?FamilyID=b9e11e83-f51b-4977-b572-8c042df802c1&displaylang=en
"Works 6.0 Converter for Works and Word Users
The Works 6.0 Converter allows you to convert word processor documents created in Microsoft Works 6.0 to Microsoft Word and other Works programs. Specifically, this converter works with Works 2000, 4.5, and 4.x, and Word 2002, 2000, and 97." | [reply] |
|
I tried this and it broke the files. The Word document didn't work and the Works file was corrupted.
| [reply] |
Re: Microsoft Works
by sgifford (Prior) on Oct 05, 2004 at 23:50 UTC
|
I'm not aware of a module like that, but here's some ideas:
- Use OLE automation to start up Word, load in the Works document, and save it as a Word document. I have no idea how to do this. :)
- If OpenOffice can read Works files, you may be able to interface with it.
| [reply] |
Re: Microsoft Works
by dragonchild (Archbishop) on Oct 06, 2004 at 13:20 UTC
|
This is a solved problem. There's no reason to learn the Works format when others have done so for you.
Note - I have never used any of the products linked in the above page. Google is usually the best place to turn for a first pass, though.
Being right, does not endow the right to be rude; politeness costs nothing. Being unknowing, is not the same as being stupid. Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence. Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.
| [reply] |
|
that's great accept for the fact that 1) the program from microsoft breaks the foot notes and 2) the internal Word converter is pointless. doesn't work with something in the format of his documents. both of these points were mentioned earlier up on the thread.
| [reply] |
|
What about the 6-100 commercial products that Google returned? I read the thread before replying. There have been enough people who wanted to do this that companies exist solely to provide conversion products. Works -> Word is a very common transition, even with random footnotes and formatting oddities. I would strongly urge you to check out the commercial options first. Most companies will let you test-drive their product to see if it will work for your needs.
Being right, does not endow the right to be rude; politeness costs nothing. Being unknowing, is not the same as being stupid. Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence. Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.
| [reply] |
|
|
|
|
|