We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Incorrect startPageIndex of paragraph

Hello, Team.

I have found a few cases when page number of paragraph is provided incorrectly by Aspose.Word. I am using version 22.4 of java Aspose.Word.
To get the page number, I am using the following code:

LayoutCollector layoutCollector = new LayoutCollector(asposeDocument);
int startPageIndex = layoutCollector.getStartPageIndex(asposeParagraph);
int endPageIndex = layoutCollector.getEndPageIndex(asposeParagraph);

In case 1: exp1.zip (42.1 KB)
Paragraph “Figure Captions” (page 8, line number 240)
It returns startPageIndex=7.

Incae 2: exp2.zip (72.2 KB)
Paragraphs on page 47:
Table 1 (line number: 1016)
The active ingredients used in cosmetic formulations (line number 1018)
and all paragraphs in the two first rows have startPageIndex=46 and endPageIndex=46. Bu all these paragraphs are located on page 47.

Could you take a look? Maybe I use incorrect way to identify page number for paragraphs?

Thank you in advance,
Svenlana

@skorpusova
Case 1. The returned page is correct because paragraph with "Figure Captions" text starts with page break, so the actual start of this paragraph is on the 7th page. Here is content of the mentioned paragraph:

<w:r w:rsidRPr="00C7690C">
	<w:rPr>
		<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
		<w:b/>
	</w:rPr>
	<w:lastRenderedPageBreak/>
	<w:br w:type="page"/>
</w:r>
<w:r w:rsidRPr="00C7690C">
	<w:rPr>
		<w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman"/>
		<w:b/>
	</w:rPr>
	<w:lastRenderedPageBreak/>
	<w:t>Figure Captions</w:t>
</w:r>

Case 2. I managed to reproduce the problem, for a sake of correction it has been logged as WORDSNET-23905. We will keep you informed and let you know once it is resolved.

@alexey.noskov, But Run “Figure Captions” is started on the page 7 too. How can it be ?

@skorpusova On my side LayoutCollector returns 8th page for Run with "Figure Captions" text. Please note, to properly layout document Aspose.Words needs fonts used in your document. If fonts used in the document cannot be found, Aspose.Words substitutes fonts, but this might lead into layout differences.