How to repeat table header row on each page in aspose pdf in java
Than you for replying @asad.ali i used that property but is not working i used like table.setreaptingRoucount(1);
Please share your complete code snippet that you have tried. We will test the scenario in our environment and address it accordingly.
ByteArrayOutputStream stream = new ByteArrayOutputStream();
Document document = new Document();
Page page = document.getPages().add();
page.setPageSize(612.0, 792.0);
Table table = new Table();
MarginInfo margin = new MarginInfo();
margin.setLeft(2f);
margin.setRight(2f);
margin.setTop(2f);
margin.setBottom(2f);
table.setDefaultCellPadding(margin);
table.setColumnAdjustment(ColumnAdjustment.AutoFitToWindow);
// Set the table border color as LightGray
table.setBorder(new BorderInfo(BorderSide.All, .1f, Color.getBlack()));
table.seRepatingRiwCount(1);
Row row0 = table.getRows().add();
row0.setBackgroundColor(Color.getBlack());
row0.setDefaultCellBorder(
new BorderInfo(BorderSide.All, .1f, Color.getBlack()));
Row row1 = table.getRows().add();
row1.getCells().add("NDC Number").getDefaultCellTextState()
.setHorizontalAlignment(HorizontalAlignment.Center);
row1.getCells().add("Drug Name").getDefaultCellTextState()
.setHorizontalAlignment(HorizontalAlignment.Center);
row1.getCells().add("Rebate Amt per Unit").getDefaultCellTextState()
.setHorizontalAlignment(HorizontalAlignment.Center);
row1.getCells().add("Total Units Reimbursed").getDefaultCellTextState()
.setHorizontalAlignment(HorizontalAlignment.Center);
row1.getCells().add("Total Rebate Amount Claimed")
.getDefaultCellTextState()
.setHorizontalAlignment(HorizontalAlignment.Center);
row1.getCells().add("Num of Script").getDefaultCellTextState()
.setHorizontalAlignment(HorizontalAlignment.Center);
row1.getCells().add("State Amt Reimbursed").getDefaultCellTextState()
.setHorizontalAlignment(HorizontalAlignment.Center);
row1.getCells().add("Other Payments").getDefaultCellTextState()
.setHorizontalAlignment(HorizontalAlignment.Center);
row1.getCells().add("Total Amount Reimbursed").getDefaultCellTextState()
.setHorizontalAlignment(HorizontalAlignment.Center);
above is just snippet of code in method
We checked your code snippet and noticed that you are adding an empty first row in your table and using setRepeatingRowsCount(1) to set only first row as repeating row. Either you should make it like setRepeatingRowsCount(2) OR you can remove/avoid adding first row with empty cells. Please let us know in case you still notice an issue.