# Print event that fires for every line?

**URL:** <https://forum.servoy.com/t/print-event-that-fires-for-every-line/16239>\
**Category:** Classic Servoy\
**Created:** [July 20, 2012, 7:43pm UTC](https://forum.servoy.com/t/print-event-that-fires-for-every-line/16239 "2012-07-20T19:43:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![djlapin](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@djlapin](https://forum.servoy.com/u/djlapin)\
**Post date:** [July 20, 2012, 7:43pm UTC](https://forum.servoy.com/t/print-event-that-fires-for-every-line/16239/1 "2012-07-20T19:43:40Z")

</div>

Is there a print event which fires for every line in a table?

Thank you,  
Don

---

<div class="post-metadata">

**Author:** ![ngervasi](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@ngervasi](https://forum.servoy.com/u/ngervasi)\
**Post date:** [July 23, 2012, 9:12am UTC](https://forum.servoy.com/t/print-event-that-fires-for-every-line/16239/2 "2012-07-23T09:12:23Z")

</div>

What are you trying to achieve exactly?

---

<div class="post-metadata">

**Author:** ![djlapin](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@djlapin](https://forum.servoy.com/u/djlapin)\
**Post date:** [July 23, 2012, 6:24pm UTC](https://forum.servoy.com/t/print-event-that-fires-for-every-line/16239/3 "2012-07-23T18:24:01Z")

</div>

I would like to be able to show/hide colored boxes, so that particular cells in the table are blocked off. Right now all I can do is place a dash (-) in a box that should be blocked off.

I would also like to alternate between thin and thick horizontal lines for even/odd rows, to make the printed form easier to use.

Thank you,  
Don

---

<div class="post-metadata">

**Author:** ![ngervasi](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@ngervasi](https://forum.servoy.com/u/ngervasi)\
**Post date:** [July 24, 2012, 11:56am UTC](https://forum.servoy.com/t/print-event-that-fires-for-every-line/16239/4 "2012-07-24T11:56:19Z")

</div>

That could be done using the onRender event (rowBgColor for Servoy 5.x) and a dedicated CSS style for the print form, have a look at the wiki to start with.

---

<div class="post-metadata">

**Author:** ![djlapin](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@djlapin](https://forum.servoy.com/u/djlapin)\
**Post date:** [July 26, 2012, 11:36pm UTC](https://forum.servoy.com/t/print-event-that-fires-for-every-line/16239/5 "2012-07-26T23:36:37Z")

</div>

Hi Nicola,

I see an ability to set color, but what about setting something to have no color? I would like to show and hide grayed-out areas (possibly rectangles). For the horizontal lines, would I have one thick horizontal line and one thin line, and alternately show and hide those by making one of them transparent?

[http://wiki.servoy.com/display/public/D … properties](http://wiki.servoy.com/display/public/DOCS/Supported+CSS+style+properties)

Also, is this stuff available for 6.0.x, or only 6.1?

Thank you,  
Don

---

<div class="post-metadata">

**Author:** ![djlapin](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@djlapin](https://forum.servoy.com/u/djlapin)\
**Post date:** [July 27, 2012, 5:45am UTC](https://forum.servoy.com/t/print-event-that-fires-for-every-line/16239/6 "2012-07-27T05:45:13Z")

</div>

Well, I figured out how to get alternate lines to print, by using two lines of different thicknesses rather than trying to change the thickness of a single line. So the top portion of this works. When I try to read the value of the contents of a field, however, I get errors for every row printed. If I use the interactive console, I can see that “item” has properties, including a field value. But I cannot seem to test the field value with this method.

```auto
function onRender_register_1_prt(event) {	
	var item = event.getRenderable();	
	var itemName = item.getName();
	if(itemName == "row_separator") {
		row_CT = row_CT + 1;
		if (row_CT % 2) {
			item.visible = true;
		} else {
			item.visible = false;
		}		
	} else if(itemName == "row_separator2") {
		if (row_CT % 2) {
			item.visible = false;
		} else {
			item.visible = true;
		}
	} else if(/^arst_col/.test(itemName)) {
		var record = event.getRecord();
		if(record[itemName] == "-") {
			item.bgcolor = "#999999";
		} else {
			item.bgcolor = "#ffffff";
		}
	}
}

```

Thank you,  
Don
