Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Developing Analytics Applications
dynamic formatting
Migrateduser
<p>Is it possible to dynamically format my report at run-time? I need to be able to set a style of a cell based upon what column and the value of the cell. So if a cells value is above 23 and it is in "column_3" .setStyleName("customStyle");. </p>
<pre class="_prettyXprint _linenums:5">
// table detail
RowHandle tabledetail = (RowHandle) table.getDetail().get(0);
for (int i = 0; i < cols.size(); i++) {
CellHandle cell = (CellHandle) tabledetail.getCells().get(i);
DataItemHandle data = designFactory.newDataItem("data_" + cols.get(i));
data.setResultSetColumn(cols.get(i));
cell.getContent().add(data);
Map<String, String> map = highlight.get(i);
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pair = (Map.Entry) it.next();
System.out.println(pair.getKey() + " = " + pair.getValue());
System.out.println("cell = " + cell);
if (cell.getContent().equals(pair.getValue())) {
cell.setStyleName("customStyle");
}
}
}
</pre>
<p>originally I only had cell.setStyleName("LabelHeader"); with out all the complex loops around it and this colored every cell in my. Later I tried the code bellow and this colored ever other column.</p>
<pre class="_prettyXprint">
if (i % 2 == 0) {
cell.setStyleName("customStyle");
}
</pre>
<p>I thought this was weird because the variable "cell" is a CellHandle and not a ColumnHandle.</p>
<p> </p>
<p>Sorry if I am missing any needed information I don't know what will be helpful. Is there a way to do this in java? Is there a better way to do this? perhaps with a script or CSS? I don't want anything to do with the report designer.</p>
Find more posts tagged with
Comments
There are no comments yet