You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by stargate625 <st...@gmail.com> on 2009/01/08 22:57:59 UTC

Can't set the table cell font type, size, and color

I used the latest beta release posted on Apache POI website in December 2008. 
The problem is that I couldn't change the font, size, and color of the text
in TableCell:

    for (int j = 0; j < cols; j++)
    {
      TableCell cell = table.getCell(0, j);
      cell.setText(data[0][j]);
      cell.setFillColor(Color.LIGHT_GRAY);
      cell.setVerticalAlignment(TextShape.AnchorMiddle);
      cell.setHorizontalAlignment(TextShape.AnchorMiddle);
     
      RichTextRun textRun = cell.getTextRun().getRichTextRuns()[0];
      textRun.setFontName("Ariel");
      textRun.setFontSize(10);       
      textRun.setBullet(false);
      textRun.setBold(true);
      textRun.setAlignment(TextShape.AlignCenter);
      textRun.setFontColor(Color.WHITE);      
    }    

Also, centering the text in the table cell resulted in only left alignment.
-- 
View this message in context: http://www.nabble.com/Can%27t-set-the-table-cell-font-type%2C-size%2C-and-color-tp21361825p21361825.html
Sent from the POI - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org