有人知道如何获取 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/