Free Support Forum - aspose.com

How to know the distance between a shape base and the bottom of the document

Hi,

I'm trying to build a diagram on a word ducument, but i need to know the remaining distance beteen a Shapebase and the bottom of the document(including the footer section).

Like this I can put a page break.

Have you a solution for me?

Thank you!

Hi

Thanks for your inquiry. You can determine this distance if you use RelativeVerticalPosition.Page; For example see the following code.

Document doc = new Document();

Shape awShape = new Shape(doc, ShapeType.Image);

awShape.ImageData.SetImage(@"Test027\test.jpg");

awShape.RelativeVerticalPosition = RelativeVerticalPosition.Page;

awShape.VerticalAlignment = VerticalAlignment.Bottom;

awShape.VerticalAlignment = VerticalAlignment.Center;

awShape.DistanceBottom = 50; //Set distance between shape and bottom of page.

doc.FirstSection.Body.LastParagraph.AppendChild(awShape);

doc.Save(@"Test027\out.doc");

But you can’t determine the end of page. Aspose.Words document represents content and formatting of a document, not its layout into lines and pages. This feature is called pagination and it is not released yet.

See FAQ for more information.

Best regards.