Multi-row "foreach" crashes


#1

Hello. There is a crash NullPointerException when trying to generate two rows using “foreach” via template and second row contains Aspose tag.
Everything is ok when Aspose tag in second row gets replaced with some constant text.

Sample attached.
HtmlTableCrash.zip (10.7 KB)


#2

@zuzuzu

Please use the <</foreach>> in new row as shown below to avoid this exception.

String html = ("<table>\n" +
        "<tr>\n" +
        "  <td><<foreach [car in cars]>><<[car.p1]>></td>\n" +
        "  <td><<[car.p2]>></td>\n" +
        "</tr>\n" +
        "<tr>\n" +
        "  <td colspan='2'>" + crashCause + "</td>\n" +
        "</tr>\n" +
        "<tr>\n" +
        "  <td colspan='2'><</foreach>></td>\n" +
        "</tr>\n" +
        "</table>")
        // escape Aspose tags in HTML
        .replaceAll("<<", "&lt;&lt;")
        .replaceAll(">>", "&gt;&gt;");

#3

Thanks a lot, that helped to avoid the crash. Unfortunately, it adds extra row at the bottom of the table (please see attached image). Our design requires borders around table cells so this extra row becomes visible. Is there a way to remove the extra row?
Extra-row.jpg (5.7 KB)


#4

@zuzuzu

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-18741. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.