Get header/footer elements positions/offset

Hi,
we would need the possibility to read the headers/footers elements positions. We are already aware that Layouter enumerator doesn’t return any position of nodes lying in header/footer sections, but in our case we don’t need the absolute position of the elements on each page, but only their relative positions on the document header/footer definition, in order to be able to reproduce them on another custom document format.
Many thanks in advance.

@renato.mauro,

Please ZIP and attach your input Word document and a screenshot showing the positions that you would like to calculate here for testing. We will then investigate the scenario on our end and provide you more information.

Please find attached a zip file containing a sample document.

HeaderFooter.zip (12.1 KB)

The picture below shows the x,y offsets (relative to header/footer section) in headers/footers elements that we need:
Aspose_Headers_Footers_Positions.png (2.1 KB)

Thanks in advance for your support.

@renato.mauro,

We have logged your requirement in our issue tracking system. Your ticket number is WORDSNET-17527. We will further look into the details of this requirement and will keep you updated on the status of the linked issue. We apologize for any inconvenience.

@renato.mauro,

I believe, you can get the coordinates of entities inside header/footer areas by using the following code:

Document doc = new Document("D:\\temp\\headerfooter.docx");            
LayoutEnumerator enumerator = new LayoutEnumerator(doc);

// move to PRIMARYFOOTER
enumerator.MoveLastChild();
// move to PRIMARYHEADER
enumerator.MovePrevious();
// move to first Line
enumerator.MoveFirstChild();
// move to Span containing text 'This'
enumerator.MoveFirstChild();

Console.WriteLine(enumerator.Text + " => Top: " + enumerator.Rectangle.Top + " , Left: " + enumerator.Rectangle.Left);

// go back to first Line
enumerator.MoveParent();
// move to second Line
enumerator.MoveNext();
// move to Span containing text 'aaa'
enumerator.MoveFirstChild();

Console.WriteLine(enumerator.Text + " => Top: " + enumerator.Rectangle.Top + " , Left: " + enumerator.Rectangle.Left);