Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically turning off Excel word wrap from CF

Status
Not open for further replies.

programmher

Programmer
May 25, 2000
235
US
I am outputting a result to an Excel spreadsheet. I need to automatically turn off the word-wrap on the spreadsheet.
Can I do this from my CF command rather than writing a macro within Excel?
 
One trick is to use:
[COLOR=008080]<table style=&quot;table-layout:fixed&quot; ...>[/color]

Then with this set you can constrain width's and heights without the text pushing out the cell. If a cell has a width set from a column above it, but no row height set from the current row, then the text will wrap. It needs both.

=== START CODE EXAMPLE ===

<cfsetting showdebugoutput=&quot;No&quot;>
<cfcontent type=&quot;application/msexcel&quot;>

[COLOR=008080]<table style=&quot;table-layout:fixed&quot;>[/color]
[COLOR=008080]<tr>[/color]
[COLOR=008080]<td height=17 width=64>[/color]This is the 1st cell of a non-wrapping row[COLOR=008080]</td>[/color]
[COLOR=008080]<td width=64>[/color]This is the 2nd cell of a non-wrapping row[COLOR=008080]</td>[/color]
[COLOR=008080]</tr>[/color]
[COLOR=008080]<tr height=17>[/color]
[COLOR=008080]<td>[/color]This is the 3rd cell of a non-wrapping row[COLOR=008080]</td>[/color]
[COLOR=008080]<td>[/color]This is the 4th cell of a non-wrapping row[COLOR=008080]</td>[/color]
[COLOR=008080]</tr>[/color]
[COLOR=008080]<tr>[/color]
[COLOR=008080]<td>[/color]This is the 5rd cell, this will wrap because I didn't set a height contraint[COLOR=008080]</td>[/color]
[COLOR=008080]<td>[/color]This is the 6th cell, this will wrap[COLOR=008080]</td>[/color]
[COLOR=008080]</tr>[/color]
[COLOR=008080]</table>[/color]

=== END CODE EXAMPLE === - tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top