LayoutEnumerator MoveNode

Hi Team,
Why have you decided to remove the LayoutEnumeraor MoveNode function ?
I would personally prefer to use this method, rather that the elaborate RenderedDocument Helper classes in your sample applications.
Could you please assist with a method to replicate the functionality in the original MoveNode function ?
I need to use it in the following fashion :

var collection = doc.GetChildNodes(NodeType.Shape, true);
foreach (var shape in collection)
{
    var renderObject = layoutEnumerator.MoveNode(shape);
    Rectangle location = renderObject.Rectangle;
    int page = renderObject.StartPage;
}

Your assistance would be greatly appreciated.
Thanks

Hi Ernest,

Thanks for your inquiry. In your case, I suggest you please check the latest DocumentLayoutHelper and EnumerateLayoutElements projects sample from the offline samples pack. This sample demonstrates how to easily work with the layout elements of a document and access the pages, lines, spans etc. Please use the latest version of Aspose.Words for .NET 13.5.0.

You may use LayoutCollector.GetStartPageIndex method. The method return 1-based index of the page where node begins. Returns 0 if node cannot be mapped to a page. I suggest you please read following documentation links.
https://reference.aspose.com/words/net/aspose.words.layout/layoutcollector/
https://reference.aspose.com/words/net/aspose.words.layout/layoutenumerator/

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

Hi Tahir,
I have had a look at those samples, hence my question of the removal of the MoveNode function. That function cleaned up all code related to finding a specific shape node’s rendering location.I have also had hassles with the sample application. I have attached a sample document for your perusal. The code crashes with null nodes and parent objects.

RenderedDocument layoutDoc = new RenderedDocument(doc); // Load the attached document
var collection = doc.GetChildNodes(NodeType.Shape, true);
foreach (var shape in collection)
{
    var entities = layoutDoc.GetLayoutEntitiesOfNode(shape as Aspose.Words.Node);
    foreach (var entity in entities)
    {
        // ... 
    }
}

Hi Team,
Any feedback ?
Thanks

Hi Ernest,

Thanks for your inquiry. I have managed to reproduce the same issue while using DocumentLayoutHelper example project. I have logged this issue as WORDSNET-8444 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Ernest,

Thanks for your inquiry.

The functionality exposed by MoveNode was shifted to separate methods when the layout was first opened up in a tweaking process. You can still achieve the same by using the LayoutCollector.GetEntity and LayoutEnumerator.Current members. Please see the example below.

LayoutCollector layoutCollector = new LayoutCollector(doc);
LayoutEnumerator layoutEnumerator = new LayoutEnumerator(doc);
var collection = doc.GetChildNodes(NodeType.Shape, true);
foreach (Shape shape in collection)
{
    var renderObject = layoutCollector.GetEntity(shape);
    layoutEnumerator.Current = renderObject;
    RectangleF location = layoutEnumerator.Rectangle;
    int page = layoutEnumerator.PageIndex;
}

Regarding the bug with the LayoutHelper example, this will be fixed in the next release.

P.S Your feedback is required on one of your other threads here.

Cheers,

hi Adam,
Thanks. This works !
I have tried to respond on the forum link you provided, but I get the following error when trying to open the post.
“The forum you requested does not exist.”
I think my priority support expired :frowning: I will renew next week, but since I receive notifications via mail on posts, I managed to read the post.
Yes please, I would love some sample code :slight_smile:
Thanks and Regards,
Ernest

Hi Ernest,

Great to hear. I will get the sample code to you asap. If there is any problem reading the reply to your thread please let us know.

Cheers,
Adam

Hi Adam,
Thanks. I am unable to read the thread you are referring to.
Regards,
Ernest

Hi Ernest,

Thanks for your inquiry.

ErnestK:
I think my priority support expired I will renew next week, but since I receive notifications via mail on posts, I managed to read the post.

If your priority support has expired, you can not access Aspose.Priority.Support forum. Please let us know if you have any more queries.

Hi Ernest,

I have posted a possible solution on the related forum thread. If you are unable to view it still please let me know and I can paste it here.

Cheers,
Adam

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

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