I'm trying to format some text in my Word doc to have a background color of gray. This is for me to have a Quick Style to apply this formatting. I want to use a monospaced font, like Consolas, and have the entire block have a gray background. When I highlight text and set the background color though, it only set the color behind the text, not the area rectangular area the text sits on within the doc layout. How can I do this?
36 Answers
I've figured out how to do this:
- Highlight arbitrary text in the document
- In the Styles chunk of the ribbon, Save Selection as new Quick Style...
- In the Modify Style dialog, click Format at the bottom.
- Select Frame
- Set Text Wrapping to Around
- Click OK, then in the Format menu select Border
- In the Shading tab, pick a Fill with the background color, e.g. gray
For Office 2007 and 2010, you'll want to use the Shading tool:
That should do what you want.
I don't have an older version of Office handy to check, but you'll probably find the same tool under Format -> Paragraph, or similar menu option.
2I have found a simpler way to do this. Step by step:
- Copy the code which you want to paste into a Word document.
- Open the link
- Paste your code into the left side box and select the appropriate language from the drop-down menu. Then click the “highlight” button.
- Copy your code from the preview section and open your Word document.
- Insert a table of 1×1 size and paste your code there. Style it according to your choice.
If something is still unclear, please have a look at this YouTube video.
From Office 2013 there is a new quick style called 'Code'. You can disable spell-check by
Format->Language->Disable automatic spell-checking.
Select the block where you want to fill the background with color, on the home section of microsoft word, above paragraph, the section where you will find the bullets & numbering there is a bucket like paint icon called the shading click the down arrow next to that icon and select any color you want to use for the background then voila!
Here is an easy method that I used. There is an office add-on after installing code formatter addon to MS word from microsoft office site. you just need to select the text and hit the code format button on word
1