2013-11-27 2 views
0

누군가가 RTF 파일의 머리글/바닥 글을 얻는 방법을 알고 있습니까? RTfEditorKit을 사용하여 다음과 같이 시도했습니다. RTFEditorKit rtf = new RTFEditorKit();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 마르쿠스

+0

RTF에서 헤더를 가져올 수 있습니까? 아래의 대답은 그것을 분명히하지 않습니다. – Panthro

답변

1

사용 public Dictionary<Object,Object> getDocumentProperties()AbstractDocument의 방법과 Document의 기존의 모든 속성을 참조하십시오.

+0

이 작업을 수행했지만 머리글과 바닥 글이 나타나지 않습니다. 내가 고급 RTFEditorKit을 시도하고, 내가 뭘 찾고 있어요. 나는 그 일을 올바르게하고 싶다. – markus0074

+0

표준 RTFEditorKit는 머리글과 바닥 글, 이미지, 표 등을 지원하지 않습니다. – StanislavL

+0

Ok. 그래서 고급 RTFEditorKit을 사용해 보겠습니다. 고스트 스타니 슬라브 – markus0074

관련 문제