有人知道如何获得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
在此先感谢您的帮助。马库斯
使用public Dictionary<Object,Object> getDocumentProperties()
的AbstractDocument
方法,并查看Document
的所有现有属性。