Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Page Layout / July 2004

Tip: Looking for answers? Try searching our database.

Shading alternate lines

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ray Greene - 21 Jul 2004 00:01 GMT
I would like  to set up a page so that it has alternate lines shaded
grey.
I want the line height to adjust to the size of the font used rather
than using a fixed image as a background, and I would prefer not to
use a table.

Can this be done?

Ray Greene.
Jezebel - 21 Jul 2004 00:30 GMT
Do-able, but very tricky. I would have thought a table in a textbox would be
the easiest, but if you don't want to do that, then a collection of shaded
rectangles might also work. The hard part of course will be setting the line
heights and positions. You'll need to take into account the font size and
line spacing. If your pages are all exactly consistent (no different-sized
headings, etc) you could attach the line shading to the header or footer.

> I would like  to set up a page so that it has alternate lines shaded
> grey.
[quoted text clipped - 5 lines]
>
> Ray Greene.
Klaus Linke - 21 Jul 2004 01:20 GMT
> > I would like  to set up a page so that it has alternate lines
> > shaded grey. [...]

Hi Ray,

If you have some simple, justified text, you might try to apply shading to
the text with a macro:

Sub AlternateShading()
 ' works properly only for simple, justified text
 ActiveDocument.Content.Characters(1).Select
 Selection.EndKey Unit:=wdLine, Extend:=wdExtend
 Do
   Selection.MoveEndWhile Cset:=Chr(13) & Chr(12) & Chr(11),
Count:=wdBackward
   Selection.Font.Shading.BackgroundPatternColor = wdColorGray20
   Selection.HomeKey Unit:=wdLine, Extend:=wdMove
   Selection.MoveDown Unit:=wdLine, Count:=2, Extend:=wdMove
   Selection.EndKey Unit:=wdLine, Extend:=wdExtend
 Loop Until Selection.End = ActiveDocument.Content.End
End Sub

If you want to shade whole lines in cases where the line ends with a
paragraph mark, you could replace the paragraph mark with a tab and a para
mark, and set a right-aligned tab at the right margin, before you run the
macro.

It's messy, and if you ever change anything (text or formatting), you have
to remove and reapply the shading.
The shading will also screw up if you move the doc to another machine with
a different printer driver (since the lines will break differently).

Greetings,
Klaus
Ray Greene - 22 Jul 2004 23:26 GMT
Thanks for the suggestions Jezebel and Klaus.
Unfortunately neither are quite what I was hoping to achieve. I
suspect that what I want can't be done in Word without using tables.

Ray Greene.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.