Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Multi-line Table header
femibyte
Hi, can someone provide a code example as to how I can programmatically create a multi-line header section for a table in BIRT using the design API ?<br />
<br />
Currently, I can create a single row header as follows:<br />
<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>TableHandle table = elementFactory.newTableItem( "table", reportCols.size() );
table.setWidth( "100%" );
table.setProperty( IReportItemModel.DATA_SET_PROP, DATA_SET_NAME );
RowHandle tableheader = (RowHandle) table.getHeader().get(0);
StyleHandle labelStyle = StyleCreator.createStyle(elementFactory,"label",
DesignChoiceConstants.FONT_STYLE_NORMAL,
DesignChoiceConstants.FONT_WEIGHT_BOLD,
DesignChoiceConstants.FONT_FAMILY_SERIF,
DesignChoiceConstants.FONT_SIZE_XX_SMALL,
"#000000");</pre>
<br />
<br />
I tried to add new rows to teh table header using something like this:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>table.getHeader().add(elementFactory.newTableRow());
table.getHeader().add(elementFactory.newTableRow());</pre>
<br />
and then<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>RowHandle tableheader0 = (RowHandle) table.getHeader().get( 0 );
RowHandle tableheader1 = (RowHandle) table.getHeader().get( 1 );</pre>
<br />
but that didn't work. Any help would be greatly appreciated.
Find more posts tagged with
Comments
mwilliams
Try using this constructor when you create the table. You can specify the number of header, detail, and footer rows when you create the table, rather than adding them later.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
TableHandle table = elementFactory.newTableItem("table", reportCols.size(), 2, 1, 1); //newTableItem(java.lang.String name, int columnNum, int headerRow, int detailRow, int footerRow)
</pre>
femibyte
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="106933" data-time="1341497265" data-date="05 July 2012 - 07:07 AM"><p>
Try using this constructor when you create the table. You can specify the number of header, detail, and footer rows when you create the table, rather than adding them later.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
TableHandle table = elementFactory.newTableItem("table", reportCols.size(), 2, 1, 1); //newTableItem(java.lang.String name, int columnNum, int headerRow, int detailRow, int footerRow)
</pre></p></blockquote>
<br />
<br />
Yes, this solved my problem. Thanks a lot for your help :-)
mwilliams
You're welcome. Let us know whenever you have questions!