@Princeshivananjappa You can use code like the following to achieve this:
Document doc = new Document(@"C:\Temp\Input_Word_document_footnote.docx");
foreach (Table table in doc.GetChildNodes(NodeType.Table, true))
{
// process only top level tables.
if (table.ParentNode.NodeType != NodeType.Body)
continue;
NodeCollection notes = table.GetChildNodes(NodeType.Footnote, true);
// Skip the table if it does not have footnotes.
if (notes.Count == 0)
continue;
// Create a row for footnotes.
Row footnotesRow = (Row)table.LastRow.Clone(true);
table.AppendChild(footnotesRow);
footnotesRow.GetChildNodes(NodeType.Paragraph, true).Clear();
if (footnotesRow.Cells.Count > 1)
{
footnotesRow.FirstCell.CellFormat.HorizontalMerge = CellMerge.First;
for (int i = 1; i < footnotesRow.Cells.Count; i++)
footnotesRow.Cells[i].CellFormat.HorizontalMerge = CellMerge.Previous;
}
// Copy content of footnotes into the newly created row.
int counter = 1;
foreach (Footnote note in notes)
{
foreach (Paragraph para in note.Paragraphs)
{
Paragraph clone = (Paragraph)para.Clone(true);
// Footnote starts with a special character, which is updated by MS Word to footnote number.
// Remove it and replace with a simple text, youo can use also list.
if (clone.FirstChild.NodeType == NodeType.SpecialChar)
{
clone.FirstChild.Remove();
Run marker = new Run(doc, counter.ToString());
marker.Font.Superscript = true;
clone.PrependChild(marker);
counter++;
}
footnotesRow.FirstCell.AppendChild(clone);
}
}
}
doc.Save(@"C:\Temp\out.docx");