LayoutCollector.GetEntity throws System.ArgumentOutOfRangeException using C#

Hello,

I’m having problem with GetEntity function from Aspose.Words.Layout. Please find the attached example application with input document. In given example it throws ArgumentOutOfRangeException with following details:

Expected a value between 0 and 0.
Parameter name: index

After removing few lines or letters from document it works, but it’s quite random. Is this something wrong with document itself, or is this function not working properly?

Thanks,
Bartosz

LayoutParserGetEntityTest.zip (27.4 KB)

@acturisaspose

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-20178. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@acturisaspose

It is to inform you that we have closed this issue with Won’t Fix resolution.

The problem is that enumerator tries to compute page for a split paragraph which, in fact, is not visible in the document at all. An intricate case where paragraph is inside a field code and finishes with a field separator and field end. These spans are rendered in the context of the next visible paragraph but technically in the document model they correspond to the runs in the invisible paragraph.

Due to layout enumerator limits, we logged new feature for such cases as WORDSNET-19733.