Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Changing Line Feed Behavior

I'm preparing an Excel report in which some cells must contain
multiple lines of text. Because of the way Excel handles line feeds,
I'm struggling to format the report properly.

From what I can figure, Excel offers two options:

1) With Wrap Text on, it will break the text at line feeds and
whenever the next word will not fit in the cell.
2) With Wrap Text off, it will never break the text; it will either
ignore line feeds or display them as squares.

What I want is a third option:
3) Break the text at line feeds only (like Notepad does when Word Wrap
is off).

Is there any way to make Excel behave that way?


-TC

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Changing Line Feed Behavior

Make you column width wider than your longest line. then it will only wrap
whre you place your LF.

"TC" wrote:

I'm preparing an Excel report in which some cells must contain
multiple lines of text. Because of the way Excel handles line feeds,
I'm struggling to format the report properly.

From what I can figure, Excel offers two options:

1) With Wrap Text on, it will break the text at line feeds and
whenever the next word will not fit in the cell.
2) With Wrap Text off, it will never break the text; it will either
ignore line feeds or display them as squares.

What I want is a third option:
3) Break the text at line feeds only (like Notepad does when Word Wrap
is off).

Is there any way to make Excel behave that way?


-TC


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Changing Line Feed Behavior

On May 25, 9:47 pm, Joel wrote:
Make you column width wider than your longest line. then it will only wrap
whre you place your LF.



"TC" wrote:
I'm preparing an Excel report in which some cells must contain
multiple lines of text. Because of the way Excel handles line feeds,
I'm struggling to format the report properly.


From what I can figure, Excel offers two options:

1) With Wrap Text on, it will break the text at line feeds and
whenever the next word will not fit in the cell.
2) With Wrap Text off, it will never break the text; it will either
ignore line feeds or display them as squares.


What I want is a third option:
3) Break the text at line feeds only (like Notepad does when Word Wrap
is off).


Is there any way to make Excel behave that way?


-TC- Hide quoted text -


- Show quoted text -


Joel,

Thank you for the advice. In fact, I'm already working on that
solution. The problem, of course, is that I'm doing this in code, and
there is no easy way to programmatically determine the length of the
longest line. My kludge is to first make the column width very large,
then auto-size it. That looks like it will work, but isn't a very
elegant solution.

-TC

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Changing Line Feed Behavior

Whilst there are various API calls available to you for working with, the
need a handle (or rather a device context) to work with, and this is not
readily exposed by Excel/VBA.

An alternative is:
- Split your text on vbLF
- Insert each into a suitably out of the way cell.
- AutoSize. Save the .ColumnWidth if the previous value.
- Set your desired .ColumnWidth on the above.

NickHK

"TC" wrote in message
oups.com...
On May 25, 9:47 pm, Joel wrote:
Make you column width wider than your longest line. then it will only

wrap
whre you place your LF.



"TC" wrote:
I'm preparing an Excel report in which some cells must contain
multiple lines of text. Because of the way Excel handles line feeds,
I'm struggling to format the report properly.


From what I can figure, Excel offers two options:
1) With Wrap Text on, it will break the text at line feeds and
whenever the next word will not fit in the cell.
2) With Wrap Text off, it will never break the text; it will either
ignore line feeds or display them as squares.


What I want is a third option:
3) Break the text at line feeds only (like Notepad does when Word Wrap
is off).


Is there any way to make Excel behave that way?


-TC- Hide quoted text -


- Show quoted text -


Joel,

Thank you for the advice. In fact, I'm already working on that
solution. The problem, of course, is that I'm doing this in code, and
there is no easy way to programmatically determine the length of the
longest line. My kludge is to first make the column width very large,
then auto-size it. That looks like it will work, but isn't a very
elegant solution.

-TC



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Challenge - Excel Line Feed Character CHR(10) - How to Delete and keep the text formatting without going ro single line in a cell ? No Name Excel Worksheet Functions 7 October 7th 09 11:10 AM
Replace Line Feed nsv Excel Discussion (Misc queries) 7 February 16th 06 04:37 PM
How to do a line feed in a Text Box 42N83W Excel Programming 1 February 8th 06 01:03 AM
Line Feed Nigel Bennett Excel Programming 2 February 17th 05 07:07 AM
how does excel store new line and line feed characters? ben h[_2_] Excel Programming 0 July 1st 04 02:34 AM


All times are GMT +1. The time now is 11:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"