Free Support Forum - aspose.com

Text Columns in Aspose.words

Hi,

Am evaluating the Aspose.words for one of my client, almost all of the feature i have migrated from MS Word library to Aspose.word library. Just one more to go, but am struggling to find the solution for the below:

We have Template document which is in .docx format. Template has a Two column page layouit. at run time system would copy paste the content from other document to this Template document. still tjis steps works fine.

When i open the template page it looks good with 2 column layout.

But we have some logic that would read the first column end of text & checks whether the text is in specific format, if it is then moves one line down which would automaticaly moves to the next column.

This logic is easily acheivable in Word but i couldn't find any refference in Aspose.words to implement that.

Also i tried to find differetn option by convering the document to Xml. & found that there is one node called <lastRenderedPageBreak>. but this node is visble only when i save the document as xml From Microsoft word. Not occurs if i save the document as xml from Aspose.words.

Please advice me to solve this issue. am in middle to sugest Aspose to my client.

Thanks in advance

Gunasekara S

Hi,


Thanks for your interest in Aspose.Words.

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.

Best regards,

Thanks for response.

We are due to buy Aspose.words next week. Suppose if above issue is fixed after we purchased the current version, is it possible to upgrade with existing license.

Right now our requirement is in testing phase, it will be better if we get beta version of Aspose(v13.1.0) rite now so that we can use it for development purpose and will confirm that our requirement is achievable and will confirm with client the same.

Thanks

Jayaprakash J

Hi Jayaprakash,


Thanks for your inquiry and sorry for the delayed response.

Sure, we welcome you to evaluate the official release of Aspose.Words 13.1 once it is released. Please read the following article:
http://www.aspose.com/docs/display/wordsnet/Evaluate+Aspose.Words

Please let us know if you need more information; we are always glad to help you.

Best regards,

Hi Awais,

Is there any update on when Aspose.words V13.1 is getting released.

Hi,


Thanks for your inquiry. The next release of Aspose.Words is due out in a couple of days (at the end of January). We will inform you as soon as it’s published.

Best regards,

Hi Awais,

Sorry for asking again, when Aspose13.1 is expected to release?

Hi,


Thanks for your patience. The new version of Aspose.Words (13.1) has just been released. Please download it from the following link:
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/entry441837.aspx

Best regards,

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

Hi Awais,

How to acheive below scenario using Apsoe.words 13.1 in .net

Read the first column end of text & checks whether the text is in specific format, if it is then moves one line down which would automaticaly moves to the next column.

Hi,

Whether this requirement could be acheived in Aspose words V13.1.0.

Hi Jayaprakash,


Thanks for your request. We are checking with this scenario and will get back to you soon.

Best regards,

Hi Awais,

Is there any update?

Hi Jayaprakash,


Thanks for your inquiry and sorry for the delay. We’re in communication with our development team and as soon as any information or code sample, to be able to achieve what you’re looking for, is available to us, we’ll be glad to share that with you.

Best regards,

Hi Awais,

Do you have any update on this one?

Hi Jayaprakash,


Thanks for your inquiry and sorry for the delay.

Update:
We will provide a way to access elements such as Paragraphs (lines) of a TextColumn and for this I have logged a new Task in our issue tracking system as WORDSNET-7780. Your request has been linked to this Task and you will be notified as soon as the requested sample code is available.

I apologize for any inconvenience.

Best regards,

Hi Jayaprakash,


Thanks for your inquiry and for your patience.

I believe what you are looking to achieve is possible using one of the samples provided in our offline samples pack. Please download that archive and from the DocumentLayoutHelper example include the RenderedDocument and LayoutEntities source files in to your application.

Then you can try using the code below to achieve your task:

<span style=“font-size:
10.0pt;font-family:“Courier New”;color:#2B91AF;mso-no-proof:yes”>Document<span style=“font-size:10.0pt;font-family:“Courier New”;mso-no-proof:yes”> 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

// the LayoutEnumerator. This allows you to access the layout entities of a document using a DOM style API.

// Create a new RenderedDocument class from a Document object.

RenderedDocument layoutDoc = new RenderedDocument(doc);

// Loop through the layout info of each page

foreach (RenderedPage page in layoutDoc.Pages)

{

if (page.Columns.Count > 1)

{

// Find the last line in the first column on the page.

RenderedLine lastLine = page.Columns.First.Lines.Last;

// This is the pargraph which belongs to the last line on the page, implement required logic and checks here.

Paragraph para = lastLine.Paragraph;

if (para.ParagraphFormat.StyleIdentifier == StyleIdentifier.Heading1)

{

// Insert a blank paragraph before the last paragraph in the column.

para.ParentNode.InsertBefore(new Paragraph(doc), para);

}

// This is how to get the first line in the second column and the related paragraph.

// Use this if it is required.

RenderedLine secondColumnLine = page.Columns[1].Lines.First;

Paragraph secondColumnPara = lastLine.Paragraph;

}

}

doc.Save(dataDir + "Test Out.docx");


Please let me know how it goes.

Thanks,

Hi Adam,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for response.

There are some concerns we are facing.

Issue 1 -

Last line is fetched wrong .Have attached document "Document-Wrong last line"

Issue is last line in first column is "The portfolio produced a positive return for the December quarter".

But value returned from below code is "Fund Performance and Activity"

Paragraph para = lastLine.Paragraph;

para.gettext();

Issue 2-

<?xml:namespace prefix = u1 />Last line is not actually fetching last line, instead its fetching last complete paragraph. Have attached document "Document-Whole Para"

Issue is last line in first column is "At an industry group level, active stock positioning within the Consumer Staples sector was the largest area of underperformance, "

But value returned from below code is complete paragraph "At an industry group level, active stock positioning within the Consumer Staples sector was the largest area of underperformance, while positive performance in stock selection within the Materials sector was the largest positive offset. At a stock level, the largest positive contributers to active returns were JP Morgan, Discover, HSBC and Microsoft, while positioning in Bank of America, Apple, Qualcomm and EMC Corp were the largest detractors over the quarter."

Paragraph para = lastLine.Paragraph;

para.getetxt();

Below code also returning last paragrah""At an industry group level, active stock positioning within the Consumer Staples sector was the largest area of underperformance, while positive performance in stock selection within the Materials sector was the largest positive offset. At a stock level, the largest positive contributers to active returns were JP Morgan, Discover, HSBC and Microsoft, while positioning in Bank of America, Apple, Qualcomm and EMC Corp were the largest detractors over the quarter."" from first column. Its not returning first line from second column which should be "while positive performance in stock selection within the Materials "

RenderedLine secondColumnLine = page.Columns[1].Lines.First;

Paragraph secondColumnPara = lastLine.Paragraph;

Issue 3-

Both document contains only 2 columns.But value page.Columns.Count is returning 3.

Issue 4 –

Suppose word document contains 4 columns. How to read last line (not paragraph) from 2nd column.

Hi Jayaprakash,


Thanks for your inquiry.

I managed to reproduce the issues you mentioned in your first and third points. I have logged these issues in our issue tracking system as WORDSNET-7791 and WORDSNET-7792 respectively. We will further look into the details of these problems and will keep you updated on the status of correction. We apologize for your inconvenience.

Secondly, to be able to read last line from second column, please use the following code:
layoutDoc.Pages[0].Columns[1].Lines.Last.Text;

I hope, this helps.

Best regards,

Hi Awais,

Thanks for response,

Have you had a look on to Issue 2. which I have mentioned Actually last complete paragraph is getting fetched, not the last line.