Share via

How can I get Word to treat underscores as spaces or hyphens (i.e. white space) for line wrapping purposes?

Anonymous
2016-01-07T16:00:34+00:00

I am building tables where the text in some of the cells may be something I want to wrap on underscores.  

For example:  As it stands, a string such as "THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG" is causing my table column to  become wider that I would like.  I have many similar tables and they should have columns of uniform width from table to table (e.g. the second column should be the same width in every table) .  I need that string to end up as follows:

THE_QUICK_BROWN_

FOX_JUMPS_OVER_THE_

LAZY_DOG

Is it possible to get Word to do this?  It is not an option for me to manually go in and adjust the contents of each cell.  I am generating these tables programmatically by building the xml of word/document.xml in the .docx file.  I could take a stab at breaking up these string into appropriately sized chunks and building my xml based on that but I would much rather let Word handle that if it is possible to do so.

In case you are interested, these capitalized, underscored strings are unique identifiers used by a messaging protocol.  I am assisting in the standardization effort for this protocol.  I was doing this in TeX but the effort requires a Word document instead.

PSS -- The required field for 'System and Device' makes no sense to me.  I am using Office 2016 for Mac.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2016-01-07T18:27:16+00:00

Well, I'm still interested in the answer but my co-worker gave me a workable hack.  I inserted a zero-width space after every underscore in the offending strings.  Unicode U+200B.  Works great.

Was this answer helpful?

6 people found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Suzanne S Barnhill 277.5K Reputation points MVP Volunteer Moderator
    2016-01-07T18:35:36+00:00

    That's what I would have suggested--wasn't sure whether you would be able to do it programmatically, though. I will also move your post to the Word for Mac forum in case the users there have other suggestions.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments