Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Jahr, 5 Monaten
Letzter Beitrag:
vor 1 Jahr, 4 Monaten
Beteiligte Autoren:
Garry Allen, Ned!, Piet van Zanten, Al

Shade alternate rows in a report

Startbeitrag von Garry Allen am 13.02.2017 18:53

As usual, seems simple but I can't figure out how to do it!


Hello Garry

Here is one method.
I use a global variable to trigger a static in the body row of each report. Most of my reports are selected from a table menu that is automatically generated from a reports data file and the ability to show the background on rows is stored in that file but can be changed on the fly.

Whatever method you eventually use to apply the colour the process boils down to counting the report body rows and the using the IsEven function colour the even rows.
You can have a defined colour or change the colour as you go - all my colours are defined in a file.

This is the global procedure I use:

PROCEDURE RepBodyCount(LBackgroundStatic = "RepBodyBackground",LBodyBackGround = True)

IF GReportdisplaybackground = True
GRepBodyLineCount ++
IF LBodyBackGround
//the report must contain a static called "RepBodyBackground"
IF IsEven(GRepBodyLineCount) //IntegerPart(GRepBodyLineCount /2) = (GRepBodyLineCount/2)
//{LBackgroundStatic}..state = grayed; {LBackgroundStatic}..Visible=True
{LBackgroundStatic}..BrushColor = SysInfo3.RepBodyBGrndColour


The body row of each report just has the static to display the colour and a call to RepBodyCount() in the "Before Printing Block_Body" event.


von Al - am 13.02.2017 19:11
Wow... I was thinking that I just couldn't find the right style for the report. After all, if I just use the wizard for a table report and pick GenSteel as a style, the report automatically has alternate rows shaded. (Although I see nothing in the code that would do it)

However, your reply gave me a clue:
First, I grouped all the controls in the body block called BodyGroup
Then I put in the report initialization code:
"gbEvenRow is boolean = False"

and in the Before Printing Body code I put
F gbEvenRow THEN
BodyGroup..BrushColor = LightGray
BodyGroup..BrushColor = Transparent
gbEvenRow = NOT gbEvenRow

Presto - it works!
Thanks for your help.

von Garry Allen - am 15.02.2017 04:13
Hi Garry,

This is possible in the Style options for the table control on the report.

See image for where this is...


[attachment 2280 rows.png]

von Ned! - am 15.02.2017 15:18
Thanks Ned. I have never seen that screen. What version are you using? I'm using WD20.

von Garry Allen - am 15.02.2017 19:54
This screenshot is from WD21. Perhaps it was one of the 921 new features?

Its the description window of a table control within a report.


von Ned! - am 16.02.2017 10:56

The feature Ned describes has been there at least from version 16.


von Piet van Zanten - am 16.02.2017 11:37
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.