Free Support Forum -

How to determine current column of a text


I am reading in a Word document with multiple columns layout with Aspose.Words and would like to determine if a text (section / paragraph) is part of a column and if yes, which one. Is this possible?

I know of the PageSetup and TextColumn relations for sections, but by reading these objects it is not possible to get at the content objects.

For example:

I make a loop over all sections in a document and would like to determine where the text of the first column starts and ends and so on for the next columns.

Thanks & regards,


Hi Kai,

Thanks for your inquiry. I am afraid, there is no direct way to determine TextColumn where the specific paragraph is placed using Aspose.Words. Microsoft Word document is flow document and does not contain any information about its layout into lines and pages. However, you should note that the ending of a TextColumn is always marked with a ColumnBreak character. May be you can retrieve a collection of nodes up to the first ControlChar.ColumnBreak Field and search for the text within this collection to determine the existence of your text .

Best Regards,

Hi Kai,

Thanks for your inquiry.

This task seems possible using the latest version of Aspose.Words. The LayoutEnumerator class has been exposed which provides access to the layout elements of a document.

We also have provided a helpful wrapper class to make common tasks with the LayoutEnumerator easier. Please download offline samples pack and from the DocumentLayoutHelper example include the RenderedDocument and LayoutEntities source files in to your application.

Then you can use code like this to find the lines of a Paragraph node:

Document doc = new Document(dataDir + “Test.docx”);<o:p></o:p>

// This sample introduces the RenderedDocument class and other related classes which provide an API wrapper for<o:p></o:p>

// the LayoutEnumerator. This allows you to access the layout entities of a document using a DOM style API.<o:p></o:p>

// Create a new RenderedDocument class from a Document object.<o:p></o:p>

RenderedDocument layoutDoc = new RenderedDocument(doc);

<span style=“font-size:
10.0pt;font-family:“Courier New”;color:blue;mso-no-proof:yes”>foreach<span style=“font-size:10.0pt;font-family:“Courier New”;mso-no-proof:yes”>(Paragraph para in


LayoutCollection<RenderedLine> linesOfPara = layoutDoc.GetLinesOfParagraph(para);

foreach (RenderedLine line in linesOfPara)



and use this code to find the lines of columns on a page:

foreach (RenderedPage page in layoutDoc.Pages)


if (page.Columns.Count > 1)


foreach (RenderedColumn column in page.Columns)




Paragraph paraOfFirstLine = column.Lines.First.Paragraph;

Paragraph paraOfLastLine = column.Lines.Last.Paragraph;




Please let me know how you go.


The issues you have found earlier (filed as WORDSNET-7780) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.