Joe,
I notice that in your response you did not come out and actually admit
that you were wrong when you said the following:
> It would launch Word, and Word would be told to open it,
> which would then puke on the file because the bytes inside
> are not what a Word document would be. At best, it will
> display a nice error saying, "This is not a Word document."
> At worst, it would actually attempt to open the thing, and
> either crash or produce a document full of garbage.
But you were. As I said in my note, "In Windows at least, Word did not
'puke on the file.' Nor did it 'display a nice error saying, "This is
not a Word document'"' Nor did it 'either crash or produce a document
full of garbage.'"
> ... I'll admit I'm surprised that it handles it so well.
> > Now, I happen to be working in Windows, but I wouldn't think
Microsoft Word would be > > any less intelligent in the Mac version
> Hah. Your faith is inspiring. :)
Actually, there should be no surprise that it works so well, nor is any
great faith required in Microsoft's abilities. The task is a fairly
trivial one.
Like you, I am no great fan of Microsoft, but sometimes they do do
things right, and opening a file on the basis of the file format it
actually uses rather than simply assuming that the file extension is
correct is a feature that is not only a nice feature but also one that
is fairly simple to implement dependably.
As you know, RTF has definite (and publicly available) specifications.
You can find them on the Microsoft Web site. Included is this statement:
"An entire RTF file is considered a group and must be enclosed in
braces. The \rtfN control word must follow the opening brace. The
numeric parameter N identifies the major version of the RTF
Specification used. The RTF standard described in this specification,
although titled as version 1.7, continues to correspond syntactically to
RTF Specification version 1. Therefore, the numeric parameter N for the
\rtf control word should still be emitted as 1."
Even I, with my limited knowledge of REALbasic, could write an RB
program to look at the contents of a file and determine (regardless of
the file extension) whether it is an RTF file.
If the file begins with "{\rtf1", there's no great risk involved in
concluding that it is a RTF file. (At least that is more dependable
than going on the basis of the file extension alone.)
Similarly, although it's slightly more complicated, I could include in
that same program the ability to look at the contents of a file and
determine whether it is a Microsoft Word file. (As far as I know, no
public specifications are available, but - like RTF files - Microsoft
Word files also have a distinctive header.)
If (with my limited expertise in REALbassic) I'm smart enough to be able
to do it, then (regardless of how low an opinion you or I may have of
Microsoft) I'm sure that a team of professional programmers at Microsoft
can do it.
If you were surprised by what I said about this behavior of Microsoft
Word, my guess is that you'll be more than surprised by what I say in my
next note about Microsoft WordPad (unless it is one of those MS trivia
facts that you have come across before).
Warm regards,
Barry
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>