Hello!
I believe I found several issues with nested tables in aspose pdf.
Currently I try to create small demos of the issues. The second is the following:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
Java2HTML: RepeatingHeaderRowIssue.java
1 package de.gad.gfw.web.print.pdf.issues;
2
3 import aspose.pdf.BorderInfo;
4 import aspose.pdf.BorderSide;
5 import aspose.pdf.Cell;
6 import aspose.pdf.ColumnAdjustmentType;
7 import aspose.pdf.MarginInfo;
8 import aspose.pdf.Pdf;
9 import aspose.pdf.Row;
10 import aspose.pdf.Section;
11 import aspose.pdf.Table;
12 import aspose.pdf.Text;
13
14 public class RepeatingHeaderRowIssue {
15 public static void main(String[] args) {
16
17 // issue 01: when using nested tables the borders of outer and inner
18 // table overlap
19 // issue 02: when using nested tables repeating header rows are not
20 // repeated
21 // issue 03: embedding fonts does not work on Windows XP and Mac OS x
22 // 10.6
23
24 // create a pdf
25 Pdf pdf = new Pdf();
26 Section sec = pdf.getSections().add();
27
28 // prepare a margin
29 MarginInfo margin = new MarginInfo();
30 margin.setLeft(5);
31 margin.setRight(5);
32 margin.setTop(5);
33 margin.setBottom(5);
34
35 // insert a bordered table with a margin of 5 points into the pdf..
36 Table outerTable = new Table(sec);
37 BorderInfo border = new BorderInfo(BorderSide.All.getValue(), 1.0f);
38 outerTable.setDefaultCellBorder(border);
39 outerTable.setDefaultCellPadding(margin);
40 sec.getParagraphs().add(outerTable);
41
42 // and insert a header row.
43 Row row = outerTable.getRows().add();
44 Cell cell = row.getCells().add();
45 cell.getParagraphs().add(new Text("header of outer table"));
46 outerTable.setRepeatingRows(1);
47
48 // insert another row with one cell
49 row = outerTable.getRows().add();
50 cell = row.getCells().add();
51
52 // Create a second bordered table with the same margin ...
53 Table innerTable = new Table(sec);
54 innerTable.setDefaultCellBorder(border);
55 innerTable.setDefaultCellPadding(margin);
56
57 // and insert it into the last cell of the outer table.
58 cell.getParagraphs().add(innerTable);
59
60 // Create a cell in the inner table put a dummy text into it and
61 // configure it as a header.
62 row = innerTable.getRows().add();
63 cell = row.getCells().add();
64 cell.getParagraphs().add(new Text("header"));
65 innerTable.setRepeatingRows(1);
66
67 // insert multiple rows in order to provoke page breaks
68 for (int i=0; i<50; i++) {
69 row = innerTable.getRows().add();
70 cell = row.getCells().add();
71 cell.getParagraphs().add(new Text("..."));
72 }
73
74 pdf.save("aspose.pdf");
75 }
76 }
The result looks like: image and image
I expected to see an outer and an inner table with one header row each. The header should be repeatet on every page but is only repeated for the outer table.
Best regards,
Juergen