Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Cell formatting issue when PDF table extends beyond one page

$
0
0
To start off, we are a licensed user. I am having an issue with the cell formatting of a pdf table when using padding on the cells and the table extends to more than one page. The first row of any page after the first one doesn't display the cells correctly. Here is code to reproduce the issue. I've also attached a screen shot of the pdf. This issue occurs with the newest pdf version 4.5 jar.

Thanks,
Frank

  public static void c() throws Exception
  {
    final Pdf pdf = new Pdf();
    final Section section = pdf.getSections().add();
    final Paragraphs paragraphs = section.getParagraphs();
    section.getPageInfo().setMargin(new MarginInfo(50.0f));
    final Table table = new Table();
    final Rows rows = table.getRows();
    table.setColumnWidths("380 80");
    paragraphs.add(table);   
    final MarginInfo mi = new MarginInfo(3.0f);
    for (int j=0; j<60; j++)
    {
      final Row row = rows.add();
      final Cells cells = row.getCells();
      Cell cell = cells.add("Row->" + (j + 1) + ":This should be CENTERED for both alignment types");
      cell.getDefaultCellTextInfo().setFontName("Arial");
      cell.isWordWrapped(true);
      cell.setBackgroundColor(new aspose.pdf.Color("#CCCCCC"));
      cell.setBorder(new BorderInfo(BorderSide.All, new aspose.pdf.Color("#000000")));
      cell.setVerticalAlignment(VerticalAlignmentType.Center);
      cell.setAlignment(AlignmentType.Center);
      cell = cells.add("Column 2");
      cell.setPadding(mi);
      cell.getDefaultCellTextInfo().setFontName("Arial");
      cell.isWordWrapped(true);
      cell.setBackgroundColor(new aspose.pdf.Color("#CCCCCC"));
      cell.setBorder(new BorderInfo(BorderSide.All, new aspose.pdf.Color("#000000")));
      cell.setVerticalAlignment(VerticalAlignmentType.Center);
      cell.setAlignment(AlignmentType.Center);
      cell.setPadding(mi);
    }
   
    pdf.save("test_font.pdf");
  }

Viewing all articles
Browse latest Browse all 3131

Trending Articles