使用Spire.Doc for Java 生成word 目录时怎么设置目录的字体样式?
要创建TOC样式并添加到文档,然后给TOC应用样式
ParagraphStyle tocStyle1 = (ParagraphStyle) Style.createBuiltinStyle(BuiltinStyle.Heading_1, document);
tocStyle1.setName("tocStyle1");
tocStyle1.getCharacterFormat().setFontName("宋体") ;
tocStyle1.getCharacterFormat().setFontSize(20) ;
document.getStyles().add(tocStyle1);
ParagraphStyle tocStyle2 = (ParagraphStyle) Style.createBuiltinStyle(BuiltinStyle.Heading_2, document);
tocStyle2.setName("tocStyle2");
tocStyle2.getCharacterFormat().setFontName("宋体") ;
tocStyle2.getCharacterFormat().setFontSize(20) ;
document.getStyles().add(tocStyle2);