We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Getting alignment and format issue when content extracted from Word Using Aspose Word

We are trying to get the content a between bookmark from the word document using Aspose Word 17.6,

In the original document the content inside in bookmark was aligned properly in table, but when we extract the content and save it as word file, table data is saved as normal paragraph tags.

I have attached the sample code and document in this ticket. Please let me know if you need any other details and please us to fix this issue.ExtractBookmark - Sample.zip (374.8 KB)

@sribalaji,

Thanks for your inquiry. Please use the following modified code snippet to get the desired output. Hope this helps you.

Bookmark Bookmark = doc.Range.Bookmarks[bookmark];
BookmarkStart bookmarkStart = Bookmark.BookmarkStart;
BookmarkEnd bookmarkEnd = Bookmark.BookmarkEnd;
//-------------- start --------------------
Node StartNode = bookmarkStart.GetAncestor(NodeType.Table);
    if (StartNode == null)
        StartNode = bookmarkStart;
//-------------- end --------------------
ArrayList extractedNodes = CommonAsposeHtmlExtraction.ExtractContent(StartNode, bookmarkEnd, true);