Book Mark give to table

I have html with following source and use insertHtml function to export the word document i want to give bookmark to the table can i?

@hafiz.sohaib.ali,

Thanks for your inquiry. In your case, we suggest you please move the cursor to the desired location and insert the bookmark. Please refer to the following article.
Inserting a Bookmark

If you still face problem, please ZIP and attach your input and expected output documents here for our reference. We will then provide you more information about your query along with code.

@tahir.manzoor thanks for replying but the problem is my table are generated dynamically i want to those table row AllowBreakAcrossPages but for specific tables?
is there any way to give some bookmark from html table tag that can be identify in aspose post processing after insertHtml function

I just see there is a way to add bookmark in html using tag

or

there is anyway use “-aw-” keywords for this

@hafiz.sohaib.ali,

Thanks for your inquiry. In your case, we suggest you please insert the bookmark in the first cell of HTML table as shown below.

<td><a name=“mybookmark”></a></td>

After inserting the HTML table into Aspose.Words DOM, you can get this table using Node.GetAncestor method as shown below. Hope this helps you.

Table table = (Table)document.Range.Bookmarks["mybookmark"].BookmarkStart.GetAncestor(NodeType.Table);

This make my work thanks
i have one more requirement like can we find specific image using bookmark like this following html

when i use this line Shape shape = (Shape)document.Range.Bookmarks[“mybookmark”].BookmarkStart.GetAncestor(NodeType.Shape);

it give me null in return please help me out

@hafiz.sohaib.ali,

Thanks for your inquiry. We suggest you please read about Aspose.Words document object model. Bookmark is a “facade” object that encapsulates two nodes BookmarkStart and BookmarkEnd in a document tree and allows to work with a bookmark as a single object. Currently bookmarks are supported only at the inline-level, that is inside Paragraph.

For following HTML fragment:
<a name=“mybookmark”><img src=“test.jpg” width=“100” height=“100” /></a>

You can use following code to get the Shape node.
Shape shape = (Shape)doc.Range.Bookmarks["mybookmark"].BookmarkStart.NextSibling;

thanks for quick reply i have one more issue regarding the please solve this

i have a table in a table of first row of first cell i have image with mark the row as RowFormat.HeadingFormat = true;

but when i am scroll the document up and down the image will be invisible from each page

please let me know what i do for fix

@hafiz.sohaib.ali,

Thanks for your inquiry. Could you please share the source of document that you used to generate this document? If you have generated this document using Aspose.Words, please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing. Thanks for your cooperation.

Here is a code you just need to install aspose from nugget website

any update on this

@hafiz.sohaib.ali,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-16537. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

this issue tracking system is not open for me

@hafiz.sohaib.ali,

Thanks for your inquiry. There is no direct way you can track issue by yourself. But, you are welcome to ask your issue status via this thread. We will verify the status from our internal issue tracking system and reply you back.

@tahir.manzoor i have one question if table row height is increase the page height it hides the content of the row, can we check and set if the height of the row is greater than the page height then alowpagebreak to true otherwise its false

@hafizsohaibali123,

Thanks for your inquiry. In your case, we suggest you please set the height rule of row as AtLeast to fix this issue. Please refer to the following article.
Specifying Row Heights

RowFormat rowFormat = …
rowFormat.Height = 100;
rowFormat.HeightRule = HeightRule.AtLeast;

@hafizsohaibali123,

Thanks for your patience. It is to inform you that the issue which you are facing is actually not a bug in Aspose.Words. So, we have closed this issue (WORDSNET-16537) as ‘Not a Bug’.

It seems that the problem is with MS Word GUI, when header row contains nested table with picture. We created similar document using the MS Word (see HandMadeDoc.zip (17.6 KB)). MS Word imports the document with the same problem.

You can workaround this issue by moving problematic image to the top level table and remove nested table which contained the picture. Please check the following code example.

DocumentBuilder builder = new DocumentBuilder();

builder.InsertHtml(File.ReadAllText(MyDir + "sample.html"));

Table table = (Table)builder.Document.GetChildNodes(NodeType.Table, true)[0];
table.Rows[0].RowFormat.HeadingFormat = true;

// Retrieve problematic image and set fill for the picture according to cell fill.
Shape image = (Shape)builder.Document.GetChildNodes(NodeType.Shape, true)[0];
image.FillColor = System.Drawing.Color.Red;

// Issue occurs in the Word GUI, when header row contains nested tables with a picture.
// Remove table which stores the image. Also remove image from the nested table.
Cell headerCell = table.FirstRow.FirstCell;
headerCell.Tables[0].Remove();
image.Remove();

// Move problematic image to the top level table.
headerCell.PrependChild(new Paragraph(builder.Document));
headerCell.FirstParagraph.AppendChild(image);

builder.Document.Save(MyDir + "18.3.docx", SaveFormat.Docx);