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

Free Support Forum - aspose.com

Can I insert something at any arbitrary location in a Word Document using Aspose?

Hi,

Is there a way in Aspose by which I can insert something at any arbitrary location in a word document.(by moving our cursor to that location ).
Say , I want to insert a field at the center of the 5th line of 7th page in a 10 page word document.

Is it possible to do the same using Aspose given the way Aspose structures the word document elements.

Looking forward to your response!

Hi,


Thanks for your inquiry. First of all, please note that MS Word document is flow document and does not contain any information about its layout into lines and pages. Therefore, technically there is no “Page” concept in Word document. Pages are created by Microsoft Word on the fly.

Secondly, Aspose.Words is quite different from the Microsoft Word’s Object Model in that it represents the document as a tree of objects more like an XML DOM tree. If you worked with any XML DOM library you will find it is easy to understand and work with Aspose.Words. When you load a Word document into Aspose.Words, it builds its DOM and all document elements and formatting are simply loaded into memory. Please read the following articles for more information on DOM:
http://www.aspose.com/docs/display/wordsjava/Object+Model+Overview
http://www.aspose.com/docs/display/wordsjava/Composition+Diagrams

However, you can insert document/field/images etc at any location of document. Please read following documentation links for your kind reference.
http://www.aspose.com/docs/display/wordsjava/DocumentBuilder+Overview
http://www.aspose.com/docs/display/wordsjava/Inserting+Document+Elements
http://www.aspose.com/docs/display/wordsjava/Moving+the+Cursor

Hope this helps you. Please let us know if you have any more queries.

Hi there,

Further to my last post, Aspose.Words uses our own Rendering Engine to layout documents into pages. The DocumentLayoutHelper demonstrates how to easily work with the layout elements of a document and access the pages, lines, spans etc. Please check my reply from here:
https://forum.aspose.com/t/53128