0

I want to paste some code in my Word document from Visual Studio 2016, but the text has a white background. For readability I want to keep the formatting and the colors of the code.

When I try to remove the shading in the Borders and Shading dialog, it says there is no shading (!). How the remove the white background?

The Reveal Formatting says: SHADING Pattern: Clear (White)

Note: I inserted the code text as an object

enter image description here

  • 1
    Can you explain what you mean by 'I inserted the code text as an object'? That implies you are using an OLE object but you mention earlier in the post that you are pasting the text. – James P Jun 10 '16 at 10:39
  • Yes I am using a OLE object where I paste the code – Tim Hovius Jun 10 '16 at 10:46
  • What is the type of the OLE object where you are pasting the code and what is the type of the main hosting document? – James P Jun 10 '16 at 10:50
1
  • Change the highlight colour (Ribbon: Home Tab / grouped under Font / Text Highlight Colour) from white to anything else or No Colour.

  • For more information, select part of the text and use Reveal Formatting (CTRL + ALT + SHIFT + S to show the styles pane \ click middle button Style Inspector \ click button Reveal Formatting).

  • No that is not the problem – Tim Hovius Jun 10 '16 at 10:58
  • 2
    @TimHovius Are you sure it isn't this solution...? I replicated your issue and it just seems to be highlighted in white: i.imgur.com/zy3UCNI.gifv – Jonno Jun 10 '16 at 11:17
  • @TimHovius I added something that could help you, although I'm sure it's about the highlight colour because there is no other colour options than what was mentioned here :) – Sanny Jun 10 '16 at 16:06
0

When I select one word, I can modify the styling with Borders and Shading (set background to transparent). When I select all the text with Ctrl+A, it's not working.

I found the solution (hard way) by writing a macro:

Sub Test()

For i = 1 To Selection.Words.Count
      Selection.Words(i).Shading.BackgroundPatternColor = wdColorAutomatic
Next i

End Sub
0

I have VS open. I opened Word, changed the background to a horrible green and then I just copied at pasted and it works and keeps formatting

enter image description here

  1. Please make sure you don't have any highligting (as pointed out by Sanny)
  2. Make sure you don't have a search as that can add highlighting
  3. Please make sure text is normal (under styles)
  4. Select all content, and right click and choose font. Then choose Text Effects (at bottom) and review all options in left menu.
  5. It's possible it's HTML. To test, copy the information and paste into Notepad. Then copy from Notepad back to Word to see if it changes.
  • Yes that is not the problem, but I want to remove the white background from the pasted text. Change your page background color for example and you will see it :) – Tim Hovius Jun 10 '16 at 10:24
  • @TimHovius, updated – Dave Jun 10 '16 at 10:40
  • But did you try copy and pasting instead of inserting objects? – Dave Jun 10 '16 at 10:53
  • Yes, but the same problem – Tim Hovius Jun 10 '16 at 10:56
  • Sorry to ask, but can you try with a new Word document? Open doc, make the background colour from the Page Layout - Page Background tab and then paste. – Dave Jun 10 '16 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.