From 6ffd4f6996bdf9ab2d7f66e6d9078c9e4c36cbb0 Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 12 Jan 2024 14:13:47 +0300 Subject: [PATCH] Fix calculating number of rows of table --- .../org/verapdf/gf/model/impl/pd/gfse/GFSETable.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/gfse/GFSETable.java b/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/gfse/GFSETable.java index 73c197616..efef35b25 100644 --- a/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/gfse/GFSETable.java +++ b/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/gfse/GFSETable.java @@ -271,13 +271,17 @@ private Integer getNumberOfColumns(GFPDStructElem firstTR) { private Integer getNumberOfRows(List listTR) { int numberOfRows = 0; - for (GFPDStructElem TR : listTR) { - List children = TR.getStructuralSignificanceChildren(); + for (int rowNumber = 0; rowNumber < listTR.size(); rowNumber++) { + List 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; + } } } }