Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 168019

Summary: [Improve Page Break Management] Page Break Properties Ignored
Product: z_Archived Reporter: Daniel Hakenjos <Daniel.Hakenjos>
Component: BIRTAssignee: Gang Liu <hustlg>
Status: VERIFIED FIXED QA Contact: Xiaodan Wang <xwang>
Severity: major    
Priority: P3 CC: bluesoldier, kgeis, wenfeng.fwd, wyan
Version: 2.1.1Keywords: plan
Target Milestone: 2.5.0 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard: Autoed
Attachments:
Description Flags
Page break in header row
none
Page break in header rows
none
Repeated Header without data none

Description Daniel Hakenjos CLA 2006-12-14 04:28:42 EST
Hello,

I'm repüorting with BIRT in Business stuff.
For the reports I have to add dynamic tables via Design Engine API.

In my tables I have multiple header rows.
I want no page break in side the header rows!

This is my code to generate the table:

			ArrayList<String> cols=new ArrayList<String>();
			cols.add("NAME");
			cols.add("INSTITUT");
			cols.add("KONTONR");
			cols.add("PRODUKT");
			cols.add("SALDO");
			cols.add("ISIN");
			cols.add("BEMERKUNG");
			
			TableHandle table = designFactory.newTableItem( "table", cols.size() + 1  );
			table.setWidth("95%");
			table.setProperty("marginLeft","12px");
			table.setProperty("marginRight","32px");
			table.setProperty("marginBottom","12px");
			table.setStyleName("Tabelle");
			table.setDataSet( designHandle.findDataSet( "ds" ) );
			
			//Breiten der Spalten festlegen
			((ColumnHandle) table.getColumns().get(0)).setProperty("width","2%");
			((ColumnHandle) table.getColumns().get(1)).setProperty("width","17%");
			((ColumnHandle) table.getColumns().get(2)).setProperty("width","18%");
			((ColumnHandle) table.getColumns().get(3)).setProperty("width","12%");
			((ColumnHandle) table.getColumns().get(4)).setProperty("width","17%");
			((ColumnHandle) table.getColumns().get(5)).setProperty("width","11%");
			((ColumnHandle) table.getColumns().get(6)).setProperty("width","10%");
			((ColumnHandle) table.getColumns().get(7)).setProperty("width","13%");

			table.getHeader().add(designFactory.newTableRow(),0);
			table.getHeader().add(designFactory.newTableRow(),0);

			//Erste Header-Zeile
			RowHandle tableHeader1=(RowHandle) table.getHeader().get(0);
			CellHandle cellHandle=designFactory.newCell();
			cellHandle.setProperty("backgroundColor","#FF0000");
			tableHeader1.getCells().add(cellHandle);
			cellHandle=designFactory.newCell();
			cellHandle.setColumnSpan(cols.size());
			LabelHandle label1 = designFactory.newLabel("Dynamsiche Test-Tabelle");	
			label1.setText("Dynamsiche Test-Tabelle");
			cellHandle.getContent( ).add( label1 );
			cellHandle.setProperty("backgroundColor","#CCCCCC");
			cellHandle.setProperty("textAlign","left");
			cellHandle.setStyleName("Blockueberschrift");
			cellHandle.setProperty("pageBreakInside","avoid");
			cellHandle.setProperty("pageBreakAfter","avoid");
			tableHeader1.getCells().add(cellHandle);

			//Zweite Header-Zeile
			RowHandle tableHeader2=(RowHandle) table.getHeader().get(1);
			cellHandle=designFactory.newCell();
			cellHandle.setColumnSpan(cols.size()+1);
			tableHeader2.getCells().add(cellHandle);
			label1 = designFactory.newLabel("secondHeaderRow");	
			label1.setText("");
			cellHandle.getContent().add(label1);
			cellHandle.setProperty("pageBreakBefore","avoid");
			cellHandle.setProperty("pageBreakInside","avoid");
			cellHandle.setProperty("pageBreakAfter","avoid");

			PropertyHandle computedSet = table.getColumnBindings( ); 
			ComputedColumn  cs1 = null;

			for( int i=0; i < cols.size(); i++){
				cs1 = StructureFactory.createComputedColumn();
				cs1.setName((String)cols.get(i));
				cs1.setExpression("dataSetRow[\"" + (String)cols.get(i) + "\"]");
				computedSet.addItem(cs1);
			}
			
			// table header
			RowHandle tableheader = (RowHandle) table.getHeader().get(2);
			for( int i=0; i < cols.size(); i++){
				label1 = designFactory.newLabel( (String)cols.get(i) );	
				label1.setText((String)cols.get(i));
				if (i==0){
					label1.setText("BETRAG / RATE IN €");
				}
				CellHandle cell = (CellHandle) tableheader.getCells( ).get( i+1 );
				cell.getContent( ).add( label1 );
				cell.setStyleName("UeberschriftZelle");
				cell.setProperty("pageBreakBefore","avoid");
				cell.setProperty("pageBreakInside","avoid");
				cell.setProperty("pageBreakAfter","avoid");
			}							

			// table detail
			RowHandle tabledetail = (RowHandle) table.getDetail( ).get( 0 );
			for( int i=0; i < cols.size(); i++){
				CellHandle cell = (CellHandle) tabledetail.getCells( ).get( i+1 );
				DataItemHandle data = designFactory.newDataItem( "data_"+(String)cols.get(i) );
				data.setResultSetColumn( (String)cols.get(i));
				cell.getContent( ).add( data );
				cell.setStyleName("Zelle");
				cell.setProperty("pageBreakInside","avoid");
			}


As you can see, I set the properties for page break in the cells.
If I set the properties to the row I get an exception!

In the attachemnts you can see that the page break properties have no effect!

For details, I'm using birt runtime 2.1.1

Thanks
Daniel
Comment 1 Daniel Hakenjos CLA 2006-12-14 04:30:32 EST
Created attachment 55651 [details]
Page break in header row

You can see a page break inside a header row
Comment 2 Daniel Hakenjos CLA 2006-12-14 04:31:18 EST
Created attachment 55652 [details]
Page break in header rows

You can see a page break in the header rows!
Comment 3 Daniel Hakenjos CLA 2006-12-14 04:32:19 EST
Created attachment 55653 [details]
Repeated Header without data

You can see that the header is repeated, but no data follows!
Comment 4 Gang Liu CLA 2006-12-21 03:32:48 EST
There ara three issues in this case:
1. Page break in a row.
   2.1.1 do not support page-break-inside: avoid on rows. 2.2 support this feature. it had been fixed in 2.2.
2. Page break in header rows
   we need support page-break-after: avoid on rows. now it had not been supported yet. please refer to related bug:164083, 150243.
3. Repeated Header without data
   An empty row (table footer) exists on the last page. If removing the table footer, this page will dispear.
Comment 5 Daniel Hakenjos CLA 2006-12-22 02:57:14 EST
(In reply to comment #4)
Espacially point 2 is very important for us. We need control over page breaks because we have to put many tables with a not predefined Number of rows in our report. In 75% of all cases we have a page break in header rows. We cant go into production state with this behaviour. Is there a timeline to resolve this bug? E.g. a solution in one of the next Milestones?
Comment 6 Wei Yan CLA 2007-05-20 22:58:09 EDT
defer to future release
Comment 7 Wenfeng Li CLA 2007-05-24 22:23:15 EDT
schedule for 2.2.1 for point 2 in comment #4.
Comment 8 Wenfeng Li CLA 2007-07-10 18:32:52 EDT
it should be 2.3.0 M1 to add new feature. 2.2.1 is maintenance release.
Comment 9 Gang Liu CLA 2008-03-11 01:42:32 EDT
*** Bug 215736 has been marked as a duplicate of this bug. ***
Comment 10 Wei Yan CLA 2008-05-28 22:28:48 EDT
defer to next major milestone.
Comment 11 Wei Yan CLA 2008-06-09 23:02:03 EDT
defer to 2.5, resolved with other pagination issues.
Comment 12 Wei Yan CLA 2009-02-04 03:31:31 EST
need more time to resolve those issues.
Comment 13 Gang Liu CLA 2009-03-03 04:21:23 EST
Support page-break-before:avoid, page-break-after:avoid and page-break-inside:avoid.
User can use page-break:avoid to control PDF pagination.
Comment 14 Xiaodan Wang CLA 2009-03-13 02:37:25 EDT
Set page-break-before:avoid, page-break-after:avoid or page-break-inside:avoid on header row can avoid page break inside them.
Verified in build (2.5.0.v20090313-0630).