Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Sep 10, 2014 4:10 pm

How Do I add footnotes when I have data in a table? I need to add a footnote next to some selected data elements in a table?
Some sample code would be very helpful.

Comments

Category Description and/or Model Serial Number Quantity Purchase Status Condition
Printer hp 1 Purchase Good
Laptop BB 2356 1 Purchase Good

akhan2003
 
Posts: 11
Joined: Tue Sep 09, 2014 6:47 pm

Thu Sep 11, 2014 5:16 am

Hello,

There are some codes for your reference.
Code: Select all
   
            Document doc = new Document();
            doc.LoadFromFile("test.docx");
            Table table = doc.Sections[0].Tables[0] as Table;
            Paragraph paragraph = table.Rows[0].Cells[0].Paragraphs[0];
            Footnote footnote = paragraph.AppendFootnote(FootnoteType.Footnote);
            footnote.TextBody.AddParagraph().AppendText("Welcome to evaluate Spire.Doc");
            TextSelection ts = paragraph.Find("footnote", false, true);
            TextRange tr = ts.GetAsOneRange();
            int index = paragraph.ChildObjects.IndexOf(tr);
            paragraph.ChildObjects.Insert(index + 1, footnote);
            doc.SaveToFile("result.docx", FileFormat.Docx);

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue Sep 16, 2014 9:19 am

Hello,

Has the issue been resolved? Could you please give us some feedback if convenience?

If there are any questions, welcome to get it back to us.
Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.Doc