脚注位置可以在每个页面的底部或文本下方。 脚注的默认数字格式是“1,2,3”,以下示例显示如何通过调用Section.FootnoteOptions的属性来设置脚注的位置,数字格式和重新启动规则。
首先,查看Microsoft Word下的脚注选项和原始示例文档文件:
![图片1](https://image.evget.com//Content/files/2017/12/18/c637783afbf34113be6a44f3330d630c636492090944325837.jpg)
![图片2](https://image.evget.com//Content/files/2017/12/18/4f1e815871ee4cafa42165f7e42bfb8e636492091217341453.jpg)
![图片3](https://image.evget.com//Content/files/2017/12/18/19898c65f39c4b7b8e7f3bdba8245626636492091354169279.jpg)
Step 1: 创建文档的新实例并从文件加载文档
Document doc = new Document();
doc.LoadFromFile("Sample.docx",FileFormat.Docx2013);
Step 2: 从文档中获取第一部分
Section sec = doc.Sections[0];
Step 3: 设置脚注的数字格式,重新启动规则和位置
sec.FootnoteOptions.NumberFormat = FootnoteNumberFormat.UpperCaseLetter;
sec.FootnoteOptions.RestartRule = FootnoteRestartRule.RestartPage;
sec.FootnoteOptions.Position = FootnotePosition.PrintAtBottomOfPage;
Step 4: 将文档保存到文件
doc.SaveToFile("Footnoteoptions.docx", FileFormat.Docx2013);
设置脚注的格式之后的截图:
![图片4](https://image.evget.com//Content/files/2017/12/18/fb6db636f2314198851f30fbf25a5977636492091505157915.jpg)
![图片5](https://image.evget.com//Content/files/2017/12/18/4e903382bf1c4c1bb5c56c9f1d7184d2636492091673097520.jpg)
完整代码
Document doc = new Document();
doc.LoadFromFile("Sample.docx", FileFormat.Docx2013);
Section sec = doc.Sections[0];
sec.FootnoteOptions.NumberFormat = FootnoteNumberFormat.UpperCaseLetter;
sec.FootnoteOptions.RestartRule = FootnoteRestartRule.RestartPage;
sec.FootnoteOptions.Position = FootnotePosition.PrintAtBottomOfPage;
Clear all the formatting for the footnote and back to the default opitions
//sec.FootnoteOptions.ClearFormatting();
doc.SaveToFile("Footnoteoptions.docx", FileFormat.Docx2013);