Hi @alexey.noskov
Footnotes should immediately follow the table or figure using superscript lowercase letters (Any text after table with font size less than or equal to 10 is considered as a footnote. System should check for starting character of the footnote. It should be superscript and lowercase.)
ihave used he blow code but not worked
static void Main(string[] args)
{
bool Allsubchecks = false;
bool flag = false;
string pagenumber = string.Empty;
List<int> lst = new List<int>();
List<Run> lst1 = new List<Run>();
Document doc = new Document("E:\\2.3.P.8 Stability - Catania.doc");
NodeCollection paragraphs1 = doc.GetChildNodes(NodeType.Paragraph, true);
foreach (Paragraph pr in paragraphs1)
{
if (!pr.IsInCell)
{
foreach (Run rn in pr.Runs)
{
if (rn.Font.Superscript)
{
lst1.Add(rn);
}
}
}
}
NodeCollection tables = doc.GetChildNodes(NodeType.Table, true);
LayoutCollector layout = new LayoutCollector(doc);
//table next paragraph with size below 12
List<Node> tablesList = doc.GetChildNodes(NodeType.Table, true).Where(x => ((Table)x).NextSibling != null && ((Table)x).NextSibling.NodeType == NodeType.Paragraph).ToList();
foreach (Table tbl in tablesList)
{
Paragraph pr = (Paragraph)tbl.NextSibling;
while (!pr.IsInCell && !pr.Range.Text.StartsWith("\f") && (pr.ParagraphFormat.StyleName.ToUpper().Contains("FOOTNOTE") || pr.Range.Text.Trim() == "" || (pr.Runs.Count > 0 && pr.Runs[0].Font.Size < 12) || lst1.Contains(pr.Runs[0])) && layout.GetStartPageIndex(pr) != 0)
{
Paragraph prc = new Paragraph(doc);
if (pr.NextSibling != null && pr.NextSibling.NodeType == NodeType.Paragraph)
{
prc = (Paragraph)pr.NextSibling;
if (pr.Range.Text.Trim() != "")
{
flag = true;
if (pr.LastChild != null)
lst.Add(layout.GetStartPageIndex(pr.LastChild));
else
lst.Add(layout.GetStartPageIndex(pr));
}
pr = prc;
}
else
{
if (pr.Range.Text.Trim() != "")
{
flag = true;
if (pr.LastChild != null)
lst.Add(layout.GetStartPageIndex(pr.LastChild));
else
lst.Add(layout.GetStartPageIndex(pr));
}
break;
}
}
}
List<Node> paragraphs = doc.GetChildNodes(NodeType.Paragraph, true).Where(x => ((Paragraph)x).ParagraphFormat.StyleName.ToUpper().Contains("FOOTNOTE") && !((Paragraph)x).IsInCell && ((Paragraph)x).PreviousSibling != null && ((Paragraph)x).PreviousSibling.NodeType == NodeType.Table).ToList();
foreach (Paragraph prlst in paragraphs)
{
Paragraph pr = prlst;
while (!pr.IsInCell && !pr.Range.Text.StartsWith("\f") && (pr.ParagraphFormat.StyleName.ToUpper().Contains("FOOTNOTE") || pr.Range.Text.Trim() == "" || (pr.Runs.Count > 0 && pr.Runs[0].Font.Size < 12) || lst1.Contains(pr.Runs[0])) && layout.GetStartPageIndex(pr) != 0)
{
Paragraph prc = new Paragraph(doc);
if (pr.NextSibling != null && pr.NextSibling.NodeType == NodeType.Paragraph)
{
prc = (Paragraph)pr.NextSibling;
if (pr.Range.Text.Trim() != "")
{
flag = true;
if (pr.LastChild != null)
lst.Add(layout.GetStartPageIndex(pr.LastChild));
else
lst.Add(layout.GetStartPageIndex(pr));
}
pr = prc;
}
else
{
if (pr.Range.Text.Trim() != "")
{
flag = true;
if (pr.LastChild != null)
lst.Add(layout.GetStartPageIndex(pr.LastChild));
else
lst.Add(layout.GetStartPageIndex(pr));
}
break;
}
}
}
doc.Save("E:\\footnote.doc");
}