473,383 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Word wrapping

We have a project where we are using the Send2fax.com gateway to send
faxes from our web site.

Send2Fax does not word wrap emails, so I have to do that manually. This
is my "quick and dirty" code:

Function WrapLine(ByVal txt, ByVal where)
Dim temp
Dim l
words = Split(txt, " ")
l = 0
For x = 0 to Ubound(words)
If l < where Then
temp = temp & words(x) & " "
l = l + Len(words(x)) + 1
ElseIf l = where Then
temp = temp & words(x) & vbCrLf
l = 0
Else
temp = temp & vbCrLf & words(x) & " "
l = Len(words(x)) + 1
End If
Next
WrapLine = temp
End Function

Function WordWrap(ByVal txt)
Dim tmp
lines = Split(txt, vbCrLf)
u = Ubound(lines)
For x = 0 to u
lines(x) = WrapLine(lines(x), 40)
tmp = tmp & lines(x) & vbCrLf
Next
WordWrap = Left(tmp, Len(tmp) - 2)
End Function

Enjoy!

--Dave
Jul 19 '05 #1
0 1389

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: yawnmoth | last post by:
word wrapping normally treats some spaces as line feeds, if there hasn't been a line feed for quite a while. so while a string with eighty consecutive a's might not word wrap, a space placed...
5
by: nimdez | last post by:
Hi, I am working on an existing code base in which a lot of data displayed to the user is formatted in tables. Most tables are printed row-by-row using printf() with "%s" print conversion...
11
by: name | last post by:
Here is a first attempt at a line/word wrapping utility. Seems to work okay, but lacks some checking stuff, etc. --------------------------------------------------------- #include <stdio.h>...
10
by: Douglas G | last post by:
I've tried various ideas on this problem, but I don't see word wrapping. Can you point out what is wrong? It's a K&R exercise, and I'm still new to programming. Other pointers would be helpful...
10
by: Jeff B. | last post by:
Has anyone come across a decent algorithm for implementing word wrap features in .net printing? I have a small component that uses basic printing techniques (i.e. e.Graphics.DrawString in a...
0
by: Brian Conway | last post by:
Anyone know how to turn off word wrapping on the datagrid. I have gone into Property Builder and shut it off there, however, it is still wrapping. Any help would be appreciated.
10
by: Lorenzo Thurman | last post by:
I have a table cell that I want to wrap text inside of. I've tried both hard and soft wrap, but Firefox refuses to obey. IE 6&7 handle the wrap just fine. Does anyone know how I can fix this?
1
by: MikeY | last post by:
Hi Everyone, How do I stop my word wrapping with in my .Net Evironment.. While coding away, I pressed "something" and I lost my horizontal scroll bar, and now all my code has been word wrapped...
1
by: =?Utf-8?B?c3VydHVyeg==?= | last post by:
Hi, I'm using VB2005 + Office XP Enterprise. If you create a Word.Application object, you risk a memory leak if your application crashes because Word.Application is an unmanaged COM Interop...
2
by: AnilM823 | last post by:
Hi all, I'm working on designing a forum. I'm using PHP, with a mysql database, displaying the user-input results in a formatted table. Pretty standard. My questions concerns word wrapping. ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.