How does Microsoft Word wrap text?

G

Guest

Hi everybody,
I'm writing a program right now that needs to display a text document with
the same kind of word wrapping as Word does, and I was wondering, does anyone
know either how Word wraps text, such as the criteria it uses, or failing
that if there is a way to find soft line breaks and mark them? I can't find
anything anywhere.

Thanks a lot,
Jezzica85
 
J

Jay Freedman

Don't try to reinvent the wheel by writing your own program. You'd
find it extraordinarily difficult, because Word takes into account the
width of each individual letter and space in each line, using
information from the font file and the printer driver. Anyway, Word
can insert hard breaks in place of the soft breaks as it creates a
text file from your document.

Open the document in Word. Go to File > Save As. Set the "Save as
type" dropdown to "Plain Text (*.txt)" and click the Save button. Word
will display a File Conversion dialog, in which you should check the
box for "Insert line breaks". Click OK, and the resulting text file
will have the same word-wrapping as the on-screen display.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top