gpt4 book ai didi

java - 如何使用 RTFEditorKit 读取页眉和页脚行

转载 作者:太空宇宙 更新时间:2023-11-04 07:14:02 25 4
gpt4 key购买 nike

有人知道如何获取 RTF 文件的页眉/页脚吗?我尝试了这样的事情(使用 RTfEditorKit):

    RTFEditorKit rtf = new RTFEditorKit();

DefaultStyledDocument docIn = (DefaultStyledDocument) rtf.createDefaultDocument();

try {

FileInputStream fi = new FileInputStream("zf_static_follow.out.rtf");
rtf.read(fi, docIn, 0);

} catch (IOException e) {

e.printStackTrace();
} catch (BadLocationException e) {

e.printStackTrace();
}

docIn.getProperty("header");// <-- null
System.out.println(docIn.getProperty("headerf")); // <--null
System.out.println(docIn.getProperty("headerl")); // <--null
System.out.println(docIn.getProperty("headerr")); // <--null

预先感谢您的帮助。br马库斯

最佳答案

使用public Dictionary<Object,Object> getDocumentProperties()方法AbstractDocument并查看 Document 的所有现有属性.

关于java - 如何使用 RTFEditorKit 读取页眉和页脚行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20244214/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com