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

Free Support Forum - aspose.com

Table and figure footnotes should appear below the figure and table

Table and figure footnotes should appear below the figure and table. Kindly help me asap.
Kindly find the below input and expected output.
Expected_output123.docx (166.2 KB)
Input_Footnotes.docx (169.2 KB)

@Princeshivananjappa What you would like to move are not footnotes, but in the first case a table row and in the second case a simple paragraph:

Red arrows show what should be moved and green show where it should be moved. As you can see there is no pattern so I am afraid there cannot be an universal code to achieve this.

@alexey.noskov Kindly Ansar asap below mentioned question.

  1. Footnotes should only appear on the last page of the table.
  2. Footnotes should appear below the table in a row.
  3. Figure footnotes should appear below the figure.

@alexey.noskov Any update on this?

@Princeshivananjappa As i mentioned here are no footnotes in your document. There is simple text, in one case it is a last row of the table in another case it is a paragraph after the table with images. Since there is no pattern which can be used to identify such paragraphs and there is no way to identify a node after which this content should be placed, we cannot suggest you an universal solution of the task.
For example for table you can use code like this to move the last row of the table and place it after the table header:

Document doc = new Document(@"C:\temp\in.docx");

// get the first table and move it's last row after the table header, which is the first row.
Table table = doc.FirstSection.Body.Tables[0];
table.InsertAfter(table.LastRow, table.FirstRow);

doc.Save(@"C:\Temp\out.docx");

With figures the case is more complicated:

Document doc = new Document(@"C:\temp\in.docx");

// Get the second table
Table table = doc.FirstSection.Body.Tables[1];

// Get the paragraph after the images caption,
// in this particular case the second paragraph after the table
Paragraph notesParagraph = (Paragraph)table.NextSibling.NextSibling;

// Insert notes paragraph at the beginning of the second row's first cell.
table.Rows[1].FirstCell.PrependChild(notesParagraph);

doc.Save(@"C:\Temp\out.docx");