To re or not to re ... ( word wrap function?)

Chris Barker chrishbarker at home.net
Mon Sep 24 16:52:26 EDT 2001


Magnus Lie Hetland wrote:

> > I also noticed that no one took my approach, which was to start at the
> > end of the line and work backwards looking for space. You all took the
> > approach of building the new line word by word from the beginning.
> 
> I'm sure that's a nice approach -- but how do you avoid ending up with
> a short first line? (A short last line is OK.)

huh?

I think what we may be getting at is what the specs are for this. I
didn't define it very clearly, because I'm not sure what I need, but I
think what I want is a little different than what most of the submitted
code did.

In this case, the text is output from MSWord, using the "save as text"
option. Unfortunatley, Word doesn't seem to have a save option that does
what we want: the "save with linebreaks" option puts in line breaks
where they are put in by word, which is specific to font and margins,
etc, so it's not what we want. I suppose I could write some kind of Word
macro that set the font to a fixed width font, and then the margins to
something that would give me the number of columns I want. AS it
happens, I don't know Word well, and don't like it, so I'm not
particularly interested in figure all that out.

Anyway, if the text comes from a source like this, I need to assume that
all the line breaks in the text really are wanted, so I need to add
breaks, but nver remove them. I don't think I'd get the short first line
problem in this case.

BTW, if someone that knows Word well knows of an easy way to do this,
I'd be glad to hear it...

-Chris


-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at home.net                 ---           ---           ---
http://members.home.net/barkerlohmann ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------



More information about the Python-list mailing list