Word格式处理控件Spire.Doc功能演示:在Java中将尾注添加到Word

本文向您展示如何使用Spire.Doc for Java在Word文档中添加尾注。

Spire.Doc for Java 是一款专业的Java Word组件,开发人员使用它可以轻松地将Word文档创建、读取、编辑、转换和打印等功能集成到自己的Java应用程序中。

本文向您展示如何使用Spire.Doc for Java在Word文档中添加尾注。点击此处下载最新版测试。

*这么优秀的国产工具怎能错过呢!在线下单专享“一口价”,查看优惠价格!想要获取更多福利的朋友可以咨询在线客服哦~

import com.spire.doc.*;import com.spire.doc.documents.Paragraph;import com.spire.doc.fields.Footnote;import com.spire.doc.fields.TextRange;import java.awt.*;public class AddEndnote {    public static void main(String[] args) {        //Create a Document object        Document doc = new Document();        //Load the sample Word file        doc.loadFromFile("C:\Users\Administrator\Desktop\sample.docx");        //Get the first section        Section section = doc.getSections().get(0);        //Get the specific paragraph to add endnote        Paragraph paragraph = section.getParagraphs().get(2);        //Add an endnote        Footnote endnote = paragraph.appendFootnote(FootnoteType.Endnote);        //Set endnote text        TextRange textRange = endnote.getTextBody().addParagraph().appendText("This is an endnote created by Spire.Doc.");        //Set text format of endnote        textRange.getCharacterFormat().setFontName("Arial");        textRange.getCharacterFormat().setFontSize(13f);        textRange.getCharacterFormat().setTextColor(Color.RED);        //Save to file        doc.saveToFile("AddEndnote.docx", FileFormat.Docx_2013);    }}

Word格式处理控件Spire.Doc功能演示:在Java中将尾注添加到Word



让人兴奋的是整合所有格式API处理套包Spire.office for Java正在网火热销售中!联系客服立马1分钟了解全部咨询!
标签:

来源:慧都

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年3月11日
下一篇 2021年3月11日

相关推荐

发表回复

登录后才能评论