Skip to content

Commit

Permalink
Fix calculating number of rows of table
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximPlusov committed Jan 12, 2024
1 parent bf5497e commit 6ffd4f6
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,17 @@ private Integer getNumberOfColumns(GFPDStructElem firstTR) {

private Integer getNumberOfRows(List<GFPDStructElem> listTR) {
int numberOfRows = 0;
for (GFPDStructElem TR : listTR) {
List<GFPDStructElem> children = TR.getStructuralSignificanceChildren();
for (int rowNumber = 0; rowNumber < listTR.size(); rowNumber++) {
List<GFPDStructElem> children = listTR.get(rowNumber).getStructuralSignificanceChildren();
if (!children.isEmpty()) {
PDStructElem elem = children.get(0);
String type = elem.getstandardType();
if (TaggedPDFConstants.TH.equals(type) || TaggedPDFConstants.TD.equals(type)) {
numberOfRows += ((GFSETableCell)elem).getRowSpan();
Long rowSpan = ((GFSETableCell)elem).getRowSpan();
numberOfRows += rowSpan;
if (rowSpan > 1) {
rowNumber += rowSpan - 1;
}
}
}
}
Expand Down

0 comments on commit 6ffd4f6

Please sign in to comment.