How to add Tab before Footnote using C#

I have a word document that has multiple footnotes and I want to add a tab before each footnotes of the document using .net


You can use TabStopCollection.Add to add a tab stop in the collection. Could you please ZIP and attach your input and expected output documents? We will then provide you more infomation about your query.

Thanks a lot for your response please find attached the input and output files taking into consideration that i am using a footnote (36.7 KB)


Following code example shows how to add tab stop before the footnote. Hope this helps you.

Document doc = new Document(MyDir + "input.docx");
foreach (Footnote footnote in doc.GetChildNodes(NodeType.Footnote, true))
    if (footnote.FootnoteType == FootnoteType.Footnote)
        TabStop ts = new TabStop(0.5 * 72, Aspose.Words.TabAlignment.Left, TabLeader.None);
        Run run = new Run(doc, ControlChar.Tab);
        footnote.FirstParagraph.InsertBefore(run, footnote.FirstParagraph.FirstChild);

doc.Save(MyDir + "20.4.docx");
1 Like

Thank you very much for your code it worked perfect , but i am just wondering how to add another
Run run = new Run(doc, ControlChar.Tab); after the footnote number so before and after the footnote number/refernce

I found this hopefully this is the rightway
Run run1 = new Run(doc, ControlChar.Tab);
footnote.FirstParagraph.InsertAfter(run1, footnote.FirstParagraph.FirstChild.NextSibling);

A post was split to a new topic: Aspose.Words queries