Results 1 to 3 of 3
  1. #1
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    PreferredWidth vs. Width (Word 2002 SP-2)

    I was beating my head against a wall for a while today with a procedure that created a table, set the .PreferredWidth for each column, and then merged the cells in selected rows. Merging the cells in the rows always blew out the .PreferredWidth settings for the entire table (i.e., the non-merged rows reverted to equal-width columns). I got the right result if I split the procedure in two, and ran the cell-merging code as a separate follow-up (after the table had had a few seconds to rest and recuperate), but couldn't otherwise get around the problem. (I tried inserting DoEvents and several other kludges between the width-setting code and the cell-merging code, to no avail).

    Now it turns out all I needed to do was change .PreferredWidth to .Width. Who knew table columns had Widths? Seems too simple.

    Anyway, so my question is: Why are there these two separate properties? Is there a time to use the one and a time to use the other?

    And if anyone knows how to get .PreferredWidths to "set" and "harden" to the point that a subsequent horizontal cell-merge in the same procedure won't undo them, I wouldn't mind knowing that either.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: PreferredWidth vs. Width (Word 2002 SP-2)

    Width is always in points, i.e. it is an absolute setting. PreferredWidth can be in points or as a percentage of the width of the table, depending on the value of PreferredWidthType, i.e, PreferredWidth can be absolute or relative.

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: PreferredWidth vs. Width (Word 2002 SP-2)

    You might enjoy this earlier thread on preferred width in tables that contain some merged cells.

    In general, it might help to think of Preferred Width as something introduced when Word tables tried to become more like HTML tables.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •