Can anyone help me to get the footnotes with superscript and first character of should be small

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");
}

@k.sukumar Unfortunately, it is not quite clear what should be the expected output of your code. Could you please attach your input and expected output document here for our reference? We will check the issue and provide you more information.

Hi @alexey.noskov,

ReferenceDoclet_withSingleCell.zip (22 Bytes)
this is the document related to the issue in page one table ending ther is footnote i have t read that footnote and superscript and that lowercase (a)…how shuold i read that lowercasesuperscript with footnote in below table

@k.sukumar It looks like the attached archive is broken. Could you please attach the files again.

2.3.P.8 Stability - Catania.docx (26.9 KB)

Hi @alexey.noskov,
please check attachment above

@k.sukumar You document actually does not have any footnotes. There are paragraphs what starts with superscripted lowercase letter, which I suppose you are considering as footnotes. You can use code like the following to get such paragraphs:

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

// Get all paragraphs, that starts with superscript Run that contains either lowercase letter 
// or lowercase letter enclosed in parentheses.
List<Paragraph> paragraphs = doc.GetChildNodes(NodeType.Paragraph, true).Cast<Paragraph>()
    .Where(p => ConsiderAsFootnote(p)).ToList();

foreach (Paragraph p in paragraphs)
    Console.WriteLine(p.ToString(SaveFormat.Text).Trim());
private static bool ConsiderAsFootnote(Paragraph p)
{
    // Skip paragraphs without children and if the first child is not Run.
    if (!p.HasChildNodes || (p.FirstChild.NodeType != NodeType.Run))
        return false;

    Run firstRun = p.Runs[0];
    // check whether the first run is superscripted.
    if (!firstRun.Font.Superscript)
        return false;

    // Check if the run contain lowercase letter or lowercase letter enclosed in parentheses.
    Regex regex = new Regex(@"\(?[a-z]\)?");

    return regex.IsMatch(firstRun.Text);
}

Hi @alexey.noskov,

i have tried this code the regular expression which you give is not working i have attached some documents please check with them. I want to move footnote into table footnote when the there is superscript and the first character of that superscript is lowercase and when size of that paragraph is below 10O-3.2.S.7.3-Stability-Data-Temperature-Cycling-Stability-Data-Cryovessels.docx (45.2 KB)
O-3.2.S.7.3-Stability-Data-Temperature-Cycling-Stability-Data-Cryovessels-Copy.docx (46.2 KB)
in the above documents when you open it you will find table 6 which is outside the table … I want to move into table footnote when it has size below 10 and it should have superscript and for that superscript the first character is lowercase… help me to find this issue

@k.sukumar Code works as expected, it detects paragraphs that starts with lowercase superscripted letter.
The document you have attached O-3.2.S.7.3-Stability-Data-Temperature-Cycling-Stability-Data-_Cryovessels_.docx does not have such paragraphs so nothing is detects.
In the another document O-3.2.S.7.3-Stability-Data-Temperature-Cycling-Stability-Data-_Cryovessels_-Copy there is one such paragraph and it is properly detected by the provided code.
Please note, the code is created for a demonstration purposes and it is not guaranteed to work in all your cases. You are free to modify the code to get the desired output.