Question

does somebody know how to get the header / footer of a RTF file ? I tried something like this (using the 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

Thanks in advance for your help. br Markus

Was it helpful?

Solution

Use public Dictionary<Object,Object> getDocumentProperties() method of AbstractDocument and see all existing properties of the Document.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top