Joe,
I realize this, but if you change the creator and type, it would
still open
in Word, right?
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.
NOT TRUE (at least in Windows - what you say may perhaps be true on the
Mac)!
It's dangerous to make logical assumptions without doing the actual
experiments. Aristotle logically argued that if something is twice as
heavy, it falls twice as fast, but Newton (and many others) by
experiment showed that what is "logical" is not necessarily true.
I just changed the file extension of an RB .xml file to .doc, and
Microsoft Word loaded it with no problems and no complaints. I also
loaded the original .xml file into Microsoft Word, and likewise there
were no problems and no complaints.
Since, of course, an .xml file is a plain text (non-styled) file, that's
the way it looks when it is loaded into Microsoft Word, whatever file
extension you give the file. Word did NOT ask me anything about
extensions or conversions or anything else. It just loaded in both
files with no complaint about the fact that the file claiming to be a
Word .doc file really wasn't, but it treated the file as if it were a
plain (non-styled).text file.
BUT it gets much more interesting. I also changed the extension of an
.rtf file to .doc, and when I loaded it into Word, not only did
Microsoft Word not ask me anything about extensions or conversions or
anything else, but also it treated the file (with a filename ending in
".doc") as an RTF file, maintaining the font size and type, the
formatting, etc. when it loaded it in. Microsoft Word did absolutely
nothing to warn the user that it wasn't really an actual Word document
but actually an RTF wolf in .doc sheep's clothing, so to speak.
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. "
Here's the point: Even though Microsoft claims to be making everything
"docucentric," the fact is that Microsoft Word does NOT assume that a
file is in the format that the file extension indicates, but rather
treats it as what it really is.
Now, I happen to be working in Windows, but I wouldn't think Microsoft
Word would be any less intelligent in the Mac version.
Here's what you can do in an RB program (at least in Windows, and I
would guess the same would be true of the Mac, but only an actual
experiment will confirm or disprove that): Save a file as "styled text"
(which in Windows means an RTF file), BUT use a filename with the .doc
filename extension.
Microsoft Word (again, this works for Windows; I can't say whether it
will work on a Mac) will not only load in the .doc file _as styled
text_, but also does not object your doing a File -> Save, _even though_
it is keeping up the charade by saving the file as a file with the .doc
filename extension but saving the file in RTF format!
Thus the file gets Saved as "styled text" (but RTF format rather than
specifically Word document format, but who's to know, since the file
extension still says ".doc"?).
Changing the subject somewhat, something that might possibly be worth
exploring is making use of Open Office rather than Microsoft Word and
Microsoft Office. I don't know the circumstances of what is trying to
be done, but "Open Office" does a tremendous job of creating documents
that are (Microsoft) Word-compatible. I don't know the extent to which
"Open Office" can be manipulated using RB, but Open Office (1) is
totally free and (2) is available for the Mac as well as for Windows.
You don't have to play Microsoft's game if you don't want to do so. In
many situations you can use Open Office instead of Microsoft Office.
(And you can program in REALbasic rather than in Microsoft Visual Basic
for Windows.)
Warm regards,
Barry
__________________________
Joseph J. Strout wrote:
At 11:09 AM -0500 3/3/06, RBNUBE wrote:
I realize this, but if you change the creator and type, it would
still open
in Word, right?
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.
_______________________________________________
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>