Sunday, October 30, 2011

Re: How to align header/footer text in cell table

Actually, I just got it working by creating my own HTMLHeader and HTMLCell.  Here it is: 

1. The HTMLHeader class: 

public class HTMLHeader extends Header<String> {
private String html;

public HTMLHeader(String html) {
super(new HTMLCell());
this.html = html;

public String getValue() {
return html;

2. The HTMLCell class:

public class HTMLCell extends AbstractCell<String> {
public HTMLCell() {

public void render(Context context, String value, SafeHtmlBuilder sb) {
if (value != null) {

3. Add the HTMLHeader aligning it to the right: 
myTable.addColumn(myColumn, new HTMLHeader("<div align=\"right\">Hooray</div>")); 

And you're done!

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment