none
Add footnotes in a table RRS feed

  • 问题

  • 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.

    2015年4月17日 8:45

答案

  • There are some codes for your reference. Use this DOC component.

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

    Hope helpful!

    2015年4月17日 9:12

全部回复

  • Web Form? Win Form?

    How do you wanna display the footnote? Inside the same cell? Or just display it in the bottom area of the form?

    https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datagrid.showfooter%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396


    大家一齊探討、學習和研究,謝謝!
    MCSD, MCAD, MCSE+I, MCDBA, MCDST, MCSA, MCTS, MCITP, MCPD,
    MCT, Microsoft Community Star(TW & HK),
    Microsoft MVP for VB.NET since 2003
    My MSMVP Blog

    請記得將對您有幫助的回覆標示為解答以幫助其他尋找解答及參與社群討論的朋友們。
    Please remember to clickMark as Answer on the post that helps you. This can be beneficial to other community members reading the thread.

    2015年4月17日 8:54
  • 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.

    Sorry forget to mention, in a word 2013.
    2015年4月17日 9:10
  • There are some codes for your reference. Use this DOC component.

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

    Hope helpful!

    2015年4月17日 9:12