// if the paragraph text matches with our table meta tag
// we will render the next table
if (isNextOrcaTable(element)) {
// TODO exceptions need to be specified
if (!bodyIterator.hasNext()) {
throw new OrcaExpressionInvalidFormatException();
}
IBodyElement tableElement = bodyIterator.next();
if (!bodyIterator.hasNext()) {
throw new OrcaExpressionInvalidFormatException();
}
IBodyElement tableEnd = bodyIterator.next();
if (!isOrcaTableEnd(tableEnd)) {
throw new OrcaExpressionInvalidFormatException();
}
DocXTableRenderer tableRenderer = new DocXTableRenderer(tableElement, this, element, context);
tableRenderer.render();
// we need to iterate each cell only if it has table
for (XWPFTableRow row : ((XWPFTable) tableElement).getRows()) {
for (XWPFTableCell cell : row.getTableCells()) {
int rowindex = ((XWPFTable) tableElement).getRows().indexOf(row);
int colindex = row.getTableCells().indexOf(cell);
Map<String, Object> cellContext = tableRenderer.getCellContext(rowindex, colindex);
renderBody(cell, cellContext);
}
}
// we are adding the position of table meta tag paragraph for remove
removingBodyElements.add(body.getBodyElements().indexOf(element));
// we are adding the position of table end meta tag paragraph for remove
removingBodyElements.add(body.getBodyElements().indexOf(tableEnd));
} else if (isRenderedElement(element)) {
if (!bodyIterator.hasNext()) {
throw new OrcaExpressionInvalidFormatException();
}
removingBodyElements.add(body.getBodyElements().indexOf(element));
Boolean isRendered = RenderedUtil.checkRendered(((XWPFParagraph) element).getParagraphText(), this, context);
isRendered = isRendered == null ? false : isRendered;
Integer indexOfEL = body.getBodyElements().indexOf(element);