Text Columns in Aspose.words

Hi Jayaprakash,

Thanks for your inquiry.

Issue 1: Please note that Aspose.Words implements it’s own document rendering engine that layouts document into pages and in addition to DOM (Document Object Model) it builds APS (Aspose Page Specification) model in memory. The newly introduced Aspose.Words.Layout Namespace just provides public classes to access those layout objects/entities when the document is formatted into pages. Moreover, when you convert a document to PDF format, the same rendering engine is used. In your case, when you produce a PDF document, you’ll notice that the last line in first column in PDF is indeed ‘Fund performance and activity’ and hence ‘layoutDoc.Pages[0].Columns[0].Lines.Last.Text’ returns the correct line.

Issue 2: In this case, Aspose.Words does the right thing; i.e. para.geText(); should return the complete text in the Paragraph. A Paragraph can have multiple lines and if you need to access the last line, please use the code mentioned in my previous post.

Issue 3: The problem occurs because you documents indeed have three columns. This is because it has two Sections on the first page. First Section has two columns and second Section has one more. So, in this case, there is no problem in Aspose.Words.

Please let me know if I can be of any further assistance.

Best regards,

Hi awais,
Thanks for reply.
Need one clarification. Suppose if ‘layoutDoc.Pages[0].Columns[0].Lines.Last.Text’’ returns last line how to check its heading and if ithe heading style is Heading 1 how to add a empty line before it.

Actually para.ParentNode.InsertBefore(new Paragraph(doc), para); is inserting a empty line before the paragraph, not before the line fetched from ‘layoutDoc.Pages[0].Columns[0].Lines.Last.Text’’

Hi Jayaprakash,

Thanks for your inquiry. Sure, you can achieve this by using the following code snippet:

Document doc = new Document(dataDir + "Document-Whole+Para.docx");

RenderedDocument layoutDoc = new RenderedDocument(doc);
Paragraph para = layoutDoc.Pages[0].Columns[0].Lines.Last.Paragraph;
Node node = para;
while (node != null)
{
    if (node.NodeType == NodeType.Paragraph)
    {
        Paragraph tempPara = (Paragraph) node;
        if (tempPara.ParagraphFormat.StyleName.Equals("Heading 1_0"))
        {
            node = tempPara;
            break;
        }
        node = node.PreviousSibling;
    }
}
if (node != null)
{
    Paragraph emptyPara = new Paragraph(doc);
    node.ParentNode.InsertBefore(emptyPara, node);
}
doc.Save(dataDir + "out.docx");

I hope, this helps.

Best regards,

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

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

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

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

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.
(1)