Menu

GridPrint

Help
2008-04-10
2013-04-10
  • Nobody/Anonymous

    I am using a GridPrint to format some data, but I've run into an issue where the cell contents can be either an Image or Text or both.  Ideally, I'd like to be able to populate a particular cell with some text and (if one is available) an image next to it (in the same cell).  I'd prefer it in the same cell, and not in the next column, because the text may or may not have an accompanying image.  So the extra column for the image might not be necessary.  Any thoughts?

    Thanks.

     
    • Matthew Hall

      Matthew Hall - 2008-04-10

      If the cell contains both text and an image, you could combine them into one Print before adding that print to the GridPrint:

      GridPrint cell = new GridPrint("d,d");
      cell.add(new TextPrint(text));
      cell.add(new ImagePrint(image));
      grid.add(cell);

      You could also use StyledTextPrint which permits any Print to be inserted alongside text, and aligns non-text elements on the text's baseline.

      Matthew

       

Log in to post a comment.

MongoDB Logo MongoDB