Free Support Forum - aspose.com

How to read last line fromt the f column using Aspose.word

Currenlty i have a word document with contents aligned in two columns. Is it possible using Aspose.Words to read last line from the first column.

Hi Jayaprakash,


Thanks for your inquiry. First of all, please note that 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/wordsnet/Object+Model+Overview
http://www.aspose.com/docs/display/wordsnet/Composition+Diagrams

Secondly, Microsoft Word document is a flow document and it does not contain any information about its layout into lines and pages. So there is no way to determine where page starts or ends.

Please use the Run.Text property to get text of each node. All text of the document is stored in runs of text. Run can only be a child of Paragraph.

Hope this answers your query. Please let us know if you have any more queries.

Thanks a lot of your repsone.

I have scenorio here and I find it difficult to achieve it. Please help.

We have an standard template with setting paragraph heading will be in style "Heading 1"

  • Suppose if the last sentence in first column is in style " Heading 1" , is it possible to move the sentence to right column.
  • If first line of right column is not in style "Heading 1", .how to insert a blank line. Suppose if its style is "Heading 1", then its not neccessary to insert blank line.

Have attached a document Post. It contains paragraph title "Heading 2 " which is in style "Heading 1 " at last line..how to move it to right column. Suppose if last line of first column is not "Heading 1", then its not neccessary to move right. Please provide me code for .net. Paragraph heading names are dynamic.

Attachied docuemtn “Post”. Please have a look.

Hi,

Whether above mentioned scenario cant be achieved using Aspose.words?

Hi Jayaprakash,


Please accept my apologies for late response.

Thanks for your inquiry. I am afraid, there is no direct way to determine the specific text in a 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, if your documents contains the ColumnBreak control characters then you can get the paragraph before ControlChar.ColumnBreak as shown in following code snippet.

<span lang=“EN-GB” style=“font-size:10.0pt;font-family:“Courier New”;color:#2B91AF;mso-font-kerning:
0pt;mso-no-proof:yes”>Document<span lang=“EN-GB” style=“font-size:10.0pt;
font-family:“Courier New”;mso-font-kerning:0pt;mso-no-proof:yes”> doc = new Document(MyDir

  • “in.docx”);<o:p></o:p>

// Retrieve all paragraphs in the document.

NodeCollection paragraphs = doc.GetChildNodes(NodeType.Paragraph, true);

// Iterate through all paragraphs

foreach (Paragraph para in paragraphs)

{

foreach (Run run in para.Runs)

{

if (run.Text.Contains(ControlChar.ColumnBreak))

{

// Your code

}

}

}

Regarding control characters, Microsoft Word documents may contain various characters that have a special meaning. Normally they are used for formatting purposes and are not drawn in the normal mode. You can make them visible if you click the Show/Hide Formatting Marks button located on the Standard toolbar. Please see the attached image for detail.

Please find the list of control characters from here:
http://www.aspose.com/docs/display/wordsnet/ControlChar+Members

Hi Jayaprakash,


Further to my last post, We have just finished integrating a feature into Aspose.Words to open up access to the rendering engine so that each element of the rendered document can be read as it appears as pages, columns, lines, spans etc. This functionality is exactly what you are looking for and will be available in the next version of Aspose.Words (13.1.0) which is due out in about a week’s time. Your request has been linked to the appropriate issue (WORDSNET-2978) in our issue tracking system and you will be notified as soon as it is resolved.

Sorry for the inconvenience.

Hi Tahir,


Has informed it seems Aspose V13.1 been released. Can you give me code in .NET to read last line from first column and read first line from second column using Aspose.words.

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


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

Hi Tahir,

Can you give me code in .NET to read last line from first column and read first line from second column using Aspose.words.

Hi Tahir,

I couldn't able to find any method/attribute/property in Aspose.words 13.1.0 to read last line from first column and read first line from second column. Please let me know how to achieve this in .net using Aspose.Words V13.1.0

Hi Jayaprakash,


Thanks for your inquiry. I am working over your query and will update you asap.

Hi Tahir,

Thanks for your reply. Can you send me logic to acheive using Aspose V13.1 asap, because its business urgency.

Hi Jayaprakash,


Please accept my apologies for late response. I have asked for the detail of new API (Aspose.Words.Layout) for your issue from our development team. As soon as, any information is shared by them, I will be more than happy to share that with you.

We are really very sorry for your inconvenience.

Thanks for response

Hi Tahir,

Do you have any update on this one?

Hi Jayaprakash,


Thanks for your inquiry and sorry for the delay.

My colleague have already answered your query here in this post. Please follow that thread for further proceedings.

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.