Word格式处理控件Spire.Doc功能演示:在Java中设置Word装订线边距

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

在 Word 中设置装订线边距

虽然您可以调整常规边距为文档装订添加更多空间,但设置装订线边距是实现相同功能的更有效方法。以下是在 Word 文档中设置装订线边距的步骤:

  • 创建一个文档实例。
  • 使用Document.loadFromFile()方法加载 Word 文档。
  • 使用Document.getSections().get()方法获取特定部分。
  • 使用Section.getPageSetup().setGutter()方法为指定部分设置装订线边距。
  • 使用Document.saveToFile()方法将文档保存到文件。

import com.spire.doc.*;import java.io.IOException;public class addGutter {    public static void main(String[] args) throws IOException {        //Create a Document instance        Document document = new Document();        //Load a sample Word document        document.loadFromFile("input.docx");        //Get the first section        Section section = document.getSections().get(0);        //Set gutter margin        section.getPageSetup().setGutter(100f);        //Save the file        document.saveToFile("addGutter_output.docx", FileFormat.Docx);    }}

Word格式处理控件Spire.Doc功能演示:在Java中设置Word装订线边距

整合所有格式API处理套包Spire.office for Java正在 火热销售中!联系客服立马1分钟了解全部咨询!

Word格式处理控件Spire.Doc功能演示:在Java中设置Word装订线边距

标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年10月16日
下一篇 2021年10月16日

相关推荐

发表回复

登录后才能评论