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

Free Support Forum - aspose.com

How can we change the font size of footnote using Aspose.Words

How can we change the font size of footnote using this way?

@preetia14,
To change the font size of the footnote please use the following code example:

Footnote f = (Footnote)doc.GetChild(NodeType.Footnote, 0, true);

// set the font size of reference mark of the footnote
f.Font.Size = 18;

// set the font size of reference text of the footnote
Paragraph p = (Paragraph)f.FirstParagraph;
p.ParagraphFormat.Style.Font.Size = 18;

I am still not able to achieve the result, I want footnote reference text to be of size 8 and my document is having font size 10. Below is code snippet:

 private class ReplaceHandler : IReplacingCallback
        {
            public ReplaceHandler(FindReplaceOptions options, string footNoteText, DocumentBuilder builder, Document doc)
            {
                value = footNoteText;
                builderFooter = builder;
                document = doc;
            }
            ReplaceAction IReplacingCallback.Replacing(ReplacingArgs e)
            {
                Footnote footnote = new Footnote(e.MatchNode.Document, FootnoteType.Footnote);
                e.MatchNode.ParentNode.InsertAfter(footnote, e.MatchNode);
                footnote.Paragraphs.Add(new Paragraph(e.MatchNode.Document));
                footnote.FirstParagraph.Runs.Add(new Run(e.MatchNode.Document, value));

                Footnote tempNote = (Footnote)document.GetChild(NodeType.Footnote, 1, true);
                Paragraph p = (Paragraph)tempNote.FirstParagraph;
                p.ParagraphFormat.Style.Font.Size = 8;

                footnote.Font.Superscript = true;
                return ReplaceAction.Replace;
            }
            private readonly string value;
            private DocumentBuilder builderFooter;
            private Document document;
        }

Also, footnote is not the first footnote of document. So, is there any way to find the particular footnote and change the font size in the above implementation. I am basically placing the footnote marker in between of a dynamically generating paragraph, and my problem is that I am not able to fix the footnote font size , if I am trying to change the size it is altering the size of complete document (to font size : 8)
Also, I am using document builder for writing data into my Word Document.

@preetia14,
To generate a footnote using ReplaceHandler and change its font size to 8 please use the following updated ReplaceHandler class:

private class ReplaceHandler : IReplacingCallback
{
    public ReplaceHandler(FindReplaceOptions options, string footNoteText, DocumentBuilder builder, Document doc)
    {
        value = footNoteText;
        builderFooter = builder;
        document = doc;
    }
    ReplaceAction IReplacingCallback.Replacing(ReplacingArgs e)
    {
        builderFooter.MoveTo(e.MatchNode.ParentNode);
        Footnote footnote = builderFooter.InsertFootnote(FootnoteType.Footnote, value);

        Paragraph p = (Paragraph)footnote.FirstParagraph;
        p.ParagraphFormat.Style.Font.Size = 8;

        footnote.Font.Superscript = true;
        return ReplaceAction.Replace;
    }
    private readonly string value;
    private DocumentBuilder builderFooter;
    private Document document;
}

Please feel free to ask in case of any other issues.

Thanks for your help, it worked well for me.