Re: Python vs Visual Basic

From: Stephen Horne ($$$$$$$$$$$$$$$$$_at_$$$$$$$$$$$$$$$$$$$$.co.uk)
Date: 10/13/03


Date: Mon, 13 Oct 2003 16:11:43 +0100

On Mon, 13 Oct 2003 07:56:45 -0700, achrist@easystreet.com wrote:

>Alex Martelli wrote:
>>
>> Orange Free wrote:
>>
>> May I suggest an alternative? Perhaps you might be satisfied with
>> generating a foo.rtf rather than foo.doc file. Now, the RTF format
>> isn't much easier or better documented than the DOC format, but it
>> has the advantage that RTF format files are TEXT.
>
>I just looked at some RTF's, and they contain Ascii character 10's (\n)
>not paired with Ascii character 13's (\r). This is not a TEXT
>format file according to MS's OS's. If you try to write this data from
>Python as a text file, you'll get the \r's inserted automatically, the
>contents of the file will change, and who knows what will result.

I just looked at an RTF file generated by MS Word. It had standard
MS-DOS line ends.

I believe that RTF doesn't much care which line-end convention you
use. RTF is meant to be a platform independent interchange file, so I
suspect programs importing them are expected to handle all common
conventions and the programs creating them probably use whatever line
end convention is normal on that platform.

Line ends are actually mostly irrelevant in RTF files. Paragraph
breaks, for instance, are specified by the '\par' RTF command. Even if
you put a line break in the middle of a text word, it doesn't seem to
break the word up once imported into Word.

I believe the line end counts as whitespace where RTF requires
whitespace, but that is its only significance. Other than that it is
ignored. Though I haven't double checked, so don't sue me if there are
some cases where that isn't true.

Certainly in the context of Alex Martellis suggestion, the "what will
result" is basically no problems whatsoever. Well, OK, I suppose the
file size will get a few bytes shorter ;-)

-- 
Steve Horne
steve at ninereeds dot fsnet dot co dot uk


Relevant Pages

  • Re: convert file from
    ... Word MVP FAQ site: http://word.mvps.org ... please post all follow-ups to the newsgroup so ... > They ARE saved as Word doc, but still want to open as RTF, and the columns ... >> is something in the file that Word is interpreting as RTF format. ...
    (microsoft.public.word.docmanagement)
  • Re: My files dont work after I got new computer
    ... those attached files aren't in RTF format. ... If you want to open them in openoffice itself, ... rename them to have a .sxw extension, though I don't have it installed ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Mailmerge in header/footer doesnt work if saving .RTF files
    ... .RTF files, and .RTF files doesn't contains Macros? ... Some of the things you describe happen because the rtf format does not ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Lines & rectangles in Access reports
    ... From what I've read in other posts, RTF format doesn't support graphic based objects, ... A better suggestion to try for non-editable RTF ... report is exported to an RTF document, those lines and rectangles vanish. ...
    (microsoft.public.access.reports)
  • Re: Thou shalt have no other gods before the ANSI C standard
    ... >Or for the Civil Service to use word processor independent RTF format. ... >No changes to the law are needed. ... I had this discussion with one of our Government agencies. ... pipex .dot. ...
    (sci.crypt)