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

Free Support Forum - aspose.com

Nodes added through InsertHtml cannot be customised through NodeInserted event?

I am inserting fragments of HTML to generate my document.

This generally works well however I have an issue that the table rows thus inserted are breaking across pages.

I assume there is no modification that I can make to my HTML in order to set this property declaratively (please let me know if I am wrong!) and it so happens in this document I am happy for all table rows to have this set to false so I have subscribed to the NodeInserted event as follows.

private void doc_NodeInserted(object sender, NodeChangedEventArgs e)
if(e.Node.NodeType == NodeType.Row)
((Aspose.Words.Tables.Row) e.Node).RowFormat.AllowBreakAcrossPages = false;

I am finding that the rows added through InsertHTML have this set to true in the final document though. I assume that some code runs after NodeInserted that overwrites my change.

I realise that in this instance I can loop through the rows after the doc is generated but thought it worth reporting.

Also just to repeat a point that I have made previously. IMO it would be a valuable addition to be able to access the associated HTML fragment in the NodeInserted event.

This would allow me to adapt to changing requirements much more flexibly as I could inspect the HTML attributes in the NodeInserted event and perform custom formatting depending on these.


Thanks for your inquiry. I managed to reproduce this problem on my side and created new issue #5948 in our defect database. I will notify you as soon as it is fixed.

As a workaround you can try using the following code.

NodeCollection rows = doc.GetChildNodes(NodeType.Row, true);

foreach (Row row in rows)


row.RowFormat.AllowBreakAcrossPages = false;


Best regards.