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

Free Support Forum - aspose.com

Get contents of Bookmark within a table with merged cells

Hi guys,


I have a table with multiple bookmarks inside. However some of the bookmarks are in cells that are MERGED.
I used that link provided by: http://www.aspose.com/docs/display/wordsnet/Extract+Content+from+a+Bookmark

which gets the content of bookmarks. If a have a normal table with multpile bookmarks it can gets the table and the bookmark, However if the table contains merged cells sometimes returns the whole table, sometimes nothing or even another bookmark.

Do you have any idea how to get the contents of a bookmark within a table which has merged cells?

Also i would like to know if it is possible, how to get a picture or chart that is inside a bookmark ( the bookmark is inside a table with merged or un-merged cells).

Also, if i have bookmarked a table and inside that table a have an image. The image is bookmarked as well. Then i want to get the image having that bookmark, but it does work again.

Thanks

Hi,


Thanks for your inquiry. Could you please attach your input Word document here for testing? We will investigate the issue on our end and provide you code to extract bookmarked content.

Secondly, yes it is possible to get reference to picture or chart which is inside bookmark. Please see Shape class and Shape.Chart property. Again, for code, please attach corresponding Word document here for our reference.

Mar_Asp:
Also, if i have bookmarked a table and inside that table a have an image. The image is bookmarked as well. Then i want to get the image having that bookmark, but it does work again.
Please attach Word document for this case, we will investigate the structure of this document and provide you code for this scenario.

PS: Please refer to the articles mentioned in Aspose.Words Document Object Model and Working with Bookmarks sections of documentation.

Best regards,

Hi,


Many thanks for your reply :slight_smile:

What i want basically, it is to be able to extract any bookmark by its name within a table.
That bookmark might be inside another bookmark or it might not. It might take one or two or more rows or let’s say two cells of the same column in two different rows. So, basically get the content of any bookmark.

The function you provided to extract content from a bookmark works only if a bookmark is inside a paragraph.


Please find attached a doc file which has ten bookmarks where i want to extract all the bookmarks inside those two tables separately. I don’t want to return the whole table where the bookmark belongs. I want to return the content of each bookmark separately.

Thanks

Hi,


Thanks for your inquiry. Please try visualizing the structure of your Document in Aspose.Words using DocumentExplorer sample project. Please use the following code if you want to get exact nodes which are enclosed between BookmarkStart and BookmarkEnd nodes:

Document doc = new Document(MyDir + @“test.docx”);

Bookmark bm = doc.Range.Bookmarks["Table1BookMark1"];

ArrayList nodes = new ArrayList();

Node currentNode = bm.BookmarkStart;

while (currentNode != null)

{

currentNode = currentNode.NextPreOrder(currentNode.Document);

if (currentNode.NodeType == NodeType.BookmarkEnd)

if (((BookmarkEnd)currentNode).Name == bm.BookmarkStart.Name)

break;

nodes.Add(currentNode);

}


Hope, this helps.

Best regards,

Hi,


Many thanks for the reply. This does not seem to be the case.

That’s the code i use to traverse the bookmarks with the BookMarkStart and BookMarkEnd.

However, it is not possible to get the bookmark content if that bookmark is inside a table in two cells of the same column and different row. I don’t want to get the whole table where a bookmark belongs or the whole row i only want the specific cells that consisted of that bookmark.

So my question is how to get the content of a bookmark which it consists of cells that are in the same column but different row. But i only want that cells not the whole rows. It seems that is not possible to get the content of a bookmark if it consists of two or three cells in within the same column and different rows (with not including the whole rows).



Please find attached a doc example. With the test i sent you if i want to get bookmark1 iget this error: Cannot insert a node of this type at this location.

Thanks
Hi again,

I totally agree that the code you provided iterates from the bookmarkstart until it finds the end.

However, if you have a bookmark within two cells:
1) in same row
2) in same column and different rows

then it does not work properly.
so let's you have another if in the code you provided:

if (currentNode is Aspose.Words.Tables.Cell)
{

}

how you can take the content of that boomark inside the cells? I want only the content of a bookmark, not the content of the whole row the bookmark exists.


Thanks

Hi,


Thanks for the additional information. You’re right, we will improve processing of bookmarks in Tables. We have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-12678. Your thread has also been linked to this issue and you will be notified as soon as this issue is resolved. Sorry for the inconvenience.

Best regards,

Hi,


Many thanks for your response.

I look forward to hearing from you soon.

Hi again,


Do you have any news regarding the bug?


I look forward to hearing from you soon.

Thanks,
Marios

Hello,


Unfortunately, same issue here too. Waiting for someone to reply with a good solution that works :frowning:

Regards
Hi Marios,

Thanks for your inquiry. Unfortunately, this issue is not resolved yet. This issue is currently pending for analysis and is in the queue. We will inform you via this thread as soon as this issue is resolved. We apologize for any inconvenience.

Best regards,

Hi,


Many thanks for your immediate response.

I look forward getting your fix :slight_smile:

Thanks,
Marios

Hi all,


I hope you had great holidays.

I was wondering if you managed to find a solution on our problem.

I look forward to hearing from you soon.

Thanks,
Marios
Hi Marios,

Thanks for your inquiry. Unfortunately, this issue is not resolved yet. This issue is still pending for analysis and is in the queue. We will inform you via this thread as soon as this issue is resolved. We apologize for your inconvenience.

Best regards,

Hi Guys,


I hope you are well.

Have you managed to fix it?

Basically what i need is the colLast and colFirst attributes when the bookmarkstart is inside a table.

I look forward to hearing from you soon.

Thanks,
Marios
Hi Marios,

Thanks for your inquiry. This problem actually requires us to implement a new feature in Aspose.Words and we regret to share with you that implementation of this issue has been postponed for now. However, the fix of this problem may definitely come onto the product roadmap in the future. Unfortunately, we can not currently promise a resolution date. We apologize for your inconvenience and thank you for your understanding.

Best regards,

Hi,


Many thanks for letting me know.

I currently use the code from here:
http://www.aspose.com/docs/display/wordsnet/Extract+Content+Overview+and+Code

I have two cases that i would like you to have a look:
If the bookmark is inside only in a single cell but you select only the content of that cell (not the cell). However, that cell may have text, images, or a whole table. Your code is failing on that.

Is it possible to take a look into that example?

Thanks,
Marios

Hi Marios,


Thanks for your inquiry. Could you please attach your sample Word document and piece of code here for testing? We will investigate the issue on our end and provide you more information.

Best regards,

Hi again,


I found another issue that is worth spending some time if you can.

Is there any function that can get all the sub nodes of a root node.

I know you have that kind of methods:

NodeCollection children = ((CompositeNode)tmpnode).ChildNodes;
foreach (CompositeNodechild in children)
{
// here you get the children of tmpnode
}

However, i want a method to get all the Descendants of a node and check if contains a specific node. (not only it’s children on the first level)


Thanks,
Marios

Hi Marios,


Thanks for your inquiry.
Marios:
However, i want a method to get all the Descendants of a node and check if contains a specific node. (not only it’s children on the first level)
We have logged your requirement in our issue tracking system as WORDSNET-13153. Our product team will further look into the details of this problem and we will keep you updated on the status of this issue. We apologize for any inconvenience.

Best regards,