Hello there:

I have an application that generates a form with multiple columns and rows
as a PDF.  I previously used iText 1.02b and had no problems.  iText 1.1 and
even the current 143 early-access all have the same problem with "empty"
cells.  They are completely suppressed (no borders are printed).  This is
disconcerting since the customer requires the cells to show up even if they
are empty.

Is this a bug in the newer releases?  I need to move from 1.02 because that
version has other issues that the newer versions have fixed.

What do I have to do to get "empty" cells to print??

--- Sample code -----

table = new Table(columns + 1);
table.setBorderColor(new Color(0,0,0));
table.setBorderWidth(1);
table.setBorder(Rectangle.TOP | Rectangle.BOTTOM | Rectangle.LEFT |
Rectangle.RIGHT);
table.setCellpadding(0);
table.setCellspacing(1);
table.setCellsFitPage(true);
table.setTableFitsPage(false);
table.setDefaultCellBorder(Rectangle.TOP | Rectangle.BOTTOM | Rectangle.LEFT
| Rectangle.RIGHT);
table.setDefaultCellBorderWidth(1);
table.setDefaultCellBorderColor(new Color(0,0,0));
table.setDefaultColspan(1);
table.setDefaultRowspan(1);
table.setWidth(100);
table.setWidths(widths);

--- (deleted) headers are dropped in here --

-- now to output data into the form proper....
Cell dataCell;
Iterator offenseIt = offenseList.iterator();
while (offenseIt.hasNext())
  {
  OffenseRecord offenseRecord = (OffenseRecord)offenseIt.next();

  // this cell prints fine...it contains data....
  dataCell = new Cell(new Phrase(offenseRecord.getCode() + ". " +
offenseRecord.getDescription(),dataFont));
  dataCell.setHorizontalAlignment(Element.ALIGN_LEFT);
  dataCell.setBorder(Rectangle.TOP | Rectangle.BOTTOM | Rectangle.LEFT |
Rectangle.RIGHT);
  dataCell.setColspan(1);
  table.addCell(dataCell);

  Iterator raceIt = raceList.iterator();
  while (raceIt.hasNext())
    {
    RaceRecord raceRecord = (RaceRecord)raceIt.next();

    String countString = " ";  // changed to SPACE and TAB and same behavior
like it is being trimmed
    int total =
schoolData.getSuspensions(raceRecord.getID(),offenseRecord.getID());
    if (total > 0)
       countString = "" + total;
    dataCell = new Cell(new Phrase(countString,dataFont));
    dataCell = new Cell(new Phrase(countString,dataFont));
    dataCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    dataCell.setColspan(1);

-- added these two lines to see if the would do the trick
    dataCell.setBorder(Rectangle.TOP | Rectangle.BOTTOM | Rectangle.LEFT |
Rectangle.RIGHT);
    dataCell.setBorderWidth(1);

-- only time a cell appears with borders is if there is number in it...
-- otherwise there is total blank space!!!

    table.addCell(dataCell);
    }      

--- End sample code -----



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to