Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Range WrapText and AutoFit with Bold

Hi,

I'm formatting some data that I've loaded programmatically into a
spreadsheet. I've started by calling WrapText on top row (the the
column headings), then AutoFit on all of the columns. It looks like a
nice start.

Then I want the column headings to be bold, so I set Bold true on that
range. I set it bold _before_ setting WrapText true and calling
AutoFit, yet the text in the headings does not fit properly. The column
widths are correct for a normal font, but bold makes the text occupy
more pixels, so some long words are being broken at the last character.

It looks like AutoFit ignores the fact that some of the text is bold.

I'm working around this by adding 2 to each column's ColumnWidth. This
looks nice for the sample data I've tried, but it's a kludge.

I'd rather get AutoFit working properly. Is this a known bug? Is there
a workaround?

-- Peter Gummer
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Range WrapText and AutoFit with Bold

If your columns are skinnier than they need to be and wrap text is set, then
excel may not widen them.

I like to select all my columns and make them as wide as they possibly could
go. Then I autofit the columns. I also use alt-enters to force new lines
within the cell so that lines break where I want them to break.

Peter Gummer wrote:

Hi,

I'm formatting some data that I've loaded programmatically into a
spreadsheet. I've started by calling WrapText on top row (the the
column headings), then AutoFit on all of the columns. It looks like a
nice start.

Then I want the column headings to be bold, so I set Bold true on that
range. I set it bold _before_ setting WrapText true and calling
AutoFit, yet the text in the headings does not fit properly. The column
widths are correct for a normal font, but bold makes the text occupy
more pixels, so some long words are being broken at the last character.

It looks like AutoFit ignores the fact that some of the text is bold.

I'm working around this by adding 2 to each column's ColumnWidth. This
looks nice for the sample data I've tried, but it's a kludge.

I'd rather get AutoFit working properly. Is this a known bug? Is there
a workaround?

-- Peter Gummer


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Range WrapText and AutoFit with Bold

Dave Peterson wrote:

If your columns are skinnier than they need to be and wrap text is
set, then excel may not widen them.


Yes, that does seem to be the case. Thanks for the suggestion.

I tried calling AutoFormat on all columns, then setting Bold and
WrapText, then calling AutoFormat again. The columns are now wider; but
they're too wide!

I've just tried something else: AutoFormat, with the Width option true.
That isn't working either.

I think I'll have to stick with my workaround.

-- Peter Gummer
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Range WrapText and AutoFit with Bold

Did you use alt-enter to force new lines in the cell--where you wanted the lines
to break?

I select all the cells on the worksheet (Ctrl-a few times).

Then I use format|column|width|255 and hit enter
then format|column|autofit

(actually, I use double click on the column separator on the column header, but
it does work for me.



Peter Gummer wrote:

Dave Peterson wrote:

If your columns are skinnier than they need to be and wrap text is
set, then excel may not widen them.


Yes, that does seem to be the case. Thanks for the suggestion.

I tried calling AutoFormat on all columns, then setting Bold and
WrapText, then calling AutoFormat again. The columns are now wider; but
they're too wide!

I've just tried something else: AutoFormat, with the Width option true.
That isn't working either.

I think I'll have to stick with my workaround.

-- Peter Gummer


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Range WrapText and AutoFit with Bold

Dave Peterson wrote:

Did you use alt-enter to force new lines in the cell--where you
wanted the lines to break?


No, I don't want to do that. I'm loading data programmatically. The
column headings will be different every time.

Then I use format|column|width|255 and hit enter
then format|column|autofit


I can do that programmatically, but then the columns are too wide. I
want the text to wrap without breaking words in the middle, widening
the columns just enough to fit whole words but not the whole text.

Thanks for the suggestions.

-- Peter Gummer
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
Missing WrapText from range object in Office Web Components Ricci Gian Maria Excel Programming 0 May 21st 05 10:29 AM
Convert from WrapText Stuart[_5_] Excel Programming 8 April 20th 04 10:23 AM
Convert from WrapText scoobydeux[_2_] Excel Programming 0 April 18th 04 03:32 PM
AutoFit method of Range class failed Wellie[_2_] Excel Programming 1 February 29th 04 02:06 PM
Autofit on rows within a specifed range roy Excel Programming 5 October 22nd 03 04:52 PM


All times are GMT +1. The time now is 08:59 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"