This will take a sting and wrap it @ 90. Just replace or set 'locString' to
the var that contains your data. Is your report text or html? If it's not
html, replace the <br> with #chr(10)##chr(13)#.

<cfif trim(locString) neq "">
        <cfset locSpace = 0>
        <cfloop condition="len(locString) gte 90">
                <cfset locSpace = refindnocase(" ",locString,90)>
                <cfif locSpace eq 0>
                        <cfbreak>
                </cfif>
                <cfoutput>#mid(locString,1,locSpace)#<br></cfoutput>
                <cfset locString = mid(locString,locSpace,len(locString))>
        </cfloop>
        <cfoutput>#locString#</cfoutput>
</cfif>

Have fun,

Justin Hansen
--------------------------
Uhlig Communications
Web Developer / Programmer
--------------------------
[EMAIL PROTECTED]
913-498-0123 ext 284
--------------------------

-----Original Message-----
From: Greg [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 11, 2002 1:05 PM
To: CF-Talk
Subject: Wrapping Text


I'm trying to get a long text string to wrap properly in a printable
report. Anyone have a graceful way of finding the last space before a
certain character, say 90? Also, I could use fixedsys font to be sure
that 90 is always a good wrapping point. Is that the best option?


______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to